rongrw has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I've recently started to use Regexp::Common to write more readable regular expressions. In particular, I'm using the "delimited" feature set to identify path names. However, it seems using backslash "\" as a delimiter won't work. The code example below illustrates the problem.
I'm not sure whether the problem is with the way I'm using Regexp::Common, or whether I've uncovered a bug with the module. Any suggestions would be most appreciated.
use Regexp::Common qw[ delimited ]; my $P1 = '../matrix-ops/matopmul.mk'; my $P2 = 'C:\matrix-ops\matopmul.mk'; print "P1 has path\n" if ($P1 =~ /$RE{delimited}{-delim => '\/'}/ ); print "P2 has path\n" if ($P2 =~ /$RE{delimited}{-delim => '\/'}/ );
Cheers, Ron.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Delimiters in Regexp::Common
by swl (Prior) on May 06, 2018 at 10:43 UTC | |
by rongrw (Acolyte) on May 06, 2018 at 14:21 UTC | |
by swl (Prior) on May 06, 2018 at 21:56 UTC | |
|
Re: Delimiters in Regexp::Common
by AnomalousMonk (Archbishop) on May 06, 2018 at 16:55 UTC | |
by Veltro (Hermit) on May 07, 2018 at 11:15 UTC | |
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 | |
| |
|
Re: Delimiters in Regexp::Common
by rongrw (Acolyte) on May 09, 2018 at 14:51 UTC | |
by AnomalousMonk (Archbishop) on May 09, 2018 at 15:28 UTC |