$_ = "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.
In reply to regexp /gs oddity or bug by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |