Why does this:
perl -e '$a="<abc|def>";$a =~ s/<(.+?)(\|.+?)>/-$1-/;print $a'
give this output:
-abc-
which looks right to me, but this:
perl -e '$a="<abc|def>";$a =~ s|<(.+?)(\|.+?)>|-$1-|;print $a'
(which is the same thing with '|' regex pattern delimiters), give this output:
-a-
I was wanting to use the regex substitution pattern delimiter '|' instead of '/' because my read data had '/' in the text, so '|' meant I didn't have to escape the '/'s.
Perl version: 5.10.1.
Thanks.
tel2
In reply to Regex delimiters: '/' vs '|' by tel2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |