Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
$_ = "is this odd or not?"; @a = /(.*? )/gs; # note the ? is followed by a space print "@a";
It only gives one match here (5.6.1, linux). With only /g it matches multiple times. It also matches multiple times with /gsi, but not with combinations of /gs and other modifiers. It does multiple matches if you replace the trailing space in the re with a \s though.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: regexp /gs oddity or bug
by TheHobbit (Pilgrim) on Apr 22, 2002 at 10:30 UTC | |
Re: regexp /gs oddity or bug
by Joost (Canon) on Apr 22, 2002 at 09:58 UTC | |
Re: regexp /gs oddity or bug
by bjelli (Pilgrim) on Apr 22, 2002 at 09:59 UTC | |
Re: regexp /gs oddity or bug
by argathin (Acolyte) on Apr 22, 2002 at 10:06 UTC | |
Re: regexp /gs oddity or bug
by belden (Friar) on Apr 22, 2002 at 16:45 UTC | |
Re: regexp /gs oddity or bug
by navels (Initiate) on Apr 22, 2002 at 19:17 UTC | |
Re: regexp /gs oddity or bug
by straywalrus (Friar) on Apr 22, 2002 at 23:39 UTC |