clueless newbie has asked for the wisdom of the Perl Monks concerning the following question:
Ave!
Is there a simpler way to use Regexp::Common patterns in a Regexp::Grammar?
thanks,use 5.026; use Data::Dumper; use Regexp::Common qw[ delimited ]; use Regexp::Grammars; =Does NOT work! my $grammar = qr{ <token: Quoted_String> ($RE{delimited}{ -delim => q{'} }{ -esc +=>q{'}}) }; =cut my $pattern=''.$RE{delimited}{ -delim => q{'} }{ -esc=>q{'}}; my $grammar = qr{ <nocontext:> <TEST> <rule: TEST> <Quoted_String> <token: Quoted_String> $pattern }; if (q{'some string with containing a '''} =~ $grammar) { warn Data::Dumper->new([\%/],[qw(*/)])->Deepcopy(1)->Indent(1)->Ma +xdepth(3)->Sortkeys(1)->Dump(),q{ }; };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to use Regexp::Common patterns in Regexp::Grammars?
by clueless newbie (Curate) on Jun 09, 2022 at 16:44 UTC | |
Re: How to use Regexp::Common patterns in Regexp::Grammars? (Properly)
by Anonymous Monk on Jun 09, 2022 at 18:23 UTC | |
by clueless newbie (Curate) on Jun 09, 2022 at 19:07 UTC | |
by Anonymous Monk on Jun 10, 2022 at 09:22 UTC |