powerman has asked for the wisdom of the Perl Monks concerning the following question:
# 2 lines regex, \n not escaped $re1 = qr/as sd/; # 2 lines regex, \n escaped $re2 = qr/as\ sd/; for ($re1, $re2) { print "$_\n"; print "ok1\n" if "as\nsd" =~ /$_/; print "ok2\n" if "as\\\nsd" =~ /$_/; print "ok3\n" if "assd" =~ /$_/; print "ok4\n" if "as\\sd" =~ /$_/; } __END__ (?-xism:as sd) ok1 (?-xism:as\ sd) ok1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: escaped \n in regex
by pfaut (Priest) on Feb 20, 2003 at 00:31 UTC | |
|
Re: escaped \n in regex
by steves (Curate) on Feb 20, 2003 at 00:34 UTC | |
|
Re: escaped \n in regex
by Pardus (Pilgrim) on Feb 20, 2003 at 13:28 UTC |