I came across a strange regex construct recently and it troubled me deeply. So I bethought myself to ask on perlmonks if this has the blessings of the Wall and the Pumpkings or if this is simply hogwash :-).
Now this use of <SAMP>($|--$)</SAMP> is what is bothering me. It seems to me that "positional anchors" if that is what we could call the use "$" this way, should only be able to be used as such, not as metachars in the other sense. I tried to test this out in a simple one-liner case but I got strange inconclusive results, so now I'm asking.if ($varstring =~ /arbITRary CharS ($|--$)/) { # do whatever }
Thanks,
Soren
In reply to Weird? regex Question by Intrepid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |