in reply to PERL regex modifiers for m//
$s = "foo\nfoot\nroot"; $s =~ /^foo/g; # matches only the first foo $s =~ /^foo/gm; # matches both foo $s =~ /f.*t/g; # matches only foot $s =~ /f.*t/gs; # matches foo\nfoot\nroot $s =~ /f.*?t/gs; # matches foo\nfoot $s =~ /^foot.*root$/g; # doesn't match $s =~ /^foot.*root$/gm; # doesn't match $s =~ /^foot.*root$/gs; # doesn't match $s =~ /^foot.*root$/gms; # matches foot\nroot
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: example of 'm / / m' related example and compare to 'm / / s'
by ww (Archbishop) on Nov 28, 2011 at 18:09 UTC | |
by ikegami (Patriarch) on Nov 28, 2011 at 18:29 UTC |