You're only looking for 1 match group. If you use 2 match groups, you 
can look for the second one:

message[/(#\w+).*(#\w+)/,2]
=> "#Ram"

-- 
Posted via http://www.ruby-forum.com/.