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 10:58

>>5,6
That will never match. .* will ensure that. ``Gona to'' doesn't make sense either. Also code] tags.
shift =~ m/go[inga]{3}(\s+to)?\s+(bed|sleep|nap|rest)/i;
print "Don't you dare $2.\n";

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