beginners  

Re: regexp question

Michael Fowler
Thu, 07 Jun 2001 09:31:51 -0700

On Thu, Jun 07, 2001 at 08:25:05AM -0700, Martin Weinless wrote:
> take the regexp '.n+..?.?v*.'
> 
> By all that is sacred, if we use the string 'supernova', there should be
> no match since there are too many characters before the 'n'

Nope.  Consider

    supern       ova
        ^^       ^
        .n+.?.?v*.

.?.?v* is all optional, and the regex engine opts out of using those
patterns in order to match the entire string.  Your pattern is also not
anchored, so the match can start anywhere.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--