|Welcome to the Monastery|
RegEx Beginning of line or whitespace matchby THRAK (Monk)
|on Feb 11, 2005 at 21:23 UTC||Need Help??|
THRAK has asked for the
wisdom of the Perl Monks concerning the following question:
I know I should be able to figure this out, but I'm kind of "code blind" at this point. I need to match "for(", but not if it is preceeded by anything other than whitespace or the beginning of the line. I can easily match the whitespace/non-whitespace, but I can't seem to figure out the "or" BOL part. Here's basic snippet of what I'm trying to do:
Changing \s+ to \s* obviously makes it match the BOL, but it also makes it match the non-whitespace also.