in reply to Re: Regexp oddity
in thread Regexp oddity

\s*? is set that way on purpose in case the words have no whitespace between them.

Replies are listed 'Best First'.
RE: RE: Re: Regexp oddity
by Ovid (Cardinal) on Jun 21, 2000 at 05:23 UTC
    The question mark in \s*? is not necessary if you are doing that "in case the words have no whitespace between them." The * quantifier matches zero or more of whatever it is quantifying.
    $test = "az"; print "Good\n" if $test =~ /a\s*z/;
    The above regex sees an 'a', followed by zero spaces, followed by a 'z'. Since this matches the value of $test, it prints "Good\n".

    Cheers!