in reply to Re: Delimiters in Regexp::Common
in thread Delimiters in Regexp::Common
No bugs if you ask me. A couple of examples of the correct way to properly use single quotes are {-delim => '/\\'} or {-delim => '\/'}/ or {-delim => '\\/'}.
How the Regex module interprets this I don't know, probably a quotemeta or something like that.The point is that in:
print "P1 has path\n" if ($P1 =~ /$RE{delimited}{ -delim => '\\\/' }/ );the quoted string becomes
-delim => '\/' ;In:
print "P1 has path\n" if ($P1 =~ /$RE{delimited}{ -delim => '\/' }/ );The quoted string becomes:
-delim => '/' ;This is because the \ is treated as an escape character beteween //.
It is always tedious in Perl how mistakes like this slip in. For example take a quick look at swl's example, I think that the '\' characters is specified twice in:
print $RE{delimited}{-delim => '[\\\/]'};I even hope that I did not make any mistakes myself right now :P
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Delimiters in Regexp::Common (updated)
by AnomalousMonk (Archbishop) on May 07, 2018 at 14:46 UTC | |
by Veltro (Hermit) on May 07, 2018 at 23:02 UTC | |
by AnomalousMonk (Archbishop) on May 08, 2018 at 20:57 UTC | |
by swl (Prior) on May 08, 2018 at 09:27 UTC | |
by Veltro (Hermit) on May 08, 2018 at 10:40 UTC | |
by swl (Prior) on May 08, 2018 at 12:30 UTC |