Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Regex Help

Name: Anonymous 2010-09-13 6:49

I am fairly new to perl and even newer to regular expressions, so if you can improve on this at all go on ahead. However, that isn't really why I came here. Basically, I want it to return true if the word(s) after "going/gonna (to)" equal either bed, sleep, nap or rest. I can't get it to work and whenever it comes close to working, it just returns true for any following word, which is not what I want.

I have this:


if($arg =~ /^I( am|'m)? go[naing]?([ to]*) /i)
{
# some code here
}


Any help is appreciate and again, if you can improve this at all, please do.

Name: Anonymous 2010-09-13 7:08

if($arg =~ /^I(?:'m| am) go(?:ing|nna) to (?:bed|sleep|nap|rest)/i)

IHBT

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List