This article is helpful:
http://www.tutorialspoint.com/ruby/ruby_regular_expressions.htm
For example, this:
/^!google (.+)/
searches for text that starts with !google
and then matches the remaining text. E.g.
on :message, /^!google (.+)/ do |m, query|
fills query with the remaining text.