Regular expression question

Posted by Poromenos on Sat 09 Nov 2002 09:40 PM — 3 posts, 9,366 views.

Greece #0
I need "Poromenos yells hello" to match on "* yells *", but i need the first asterisk to be one word, i.e. match on "Poromenos yells hi" but not on "Poro menos yells hi". How can i do that?
Australia Forum Administrator #1
Take a look at the regular expression documentation file. There are all sorts of things you can do. In this case, you want a "word" character, eg.

^(\w+) yells (.*)$

Alternatively, just use something simple like this:

^([A-Za-z]+) yells (.*)$

That would be slightly different. The "word" character is defined as a letter, digit, or underscore. Choose which you prefer.
Greece #2
Ahh thanks a lot :)