use 5.026; use Data::Dumper; use Regexp::Common qw[ delimited ]; use Regexp::Grammars; =Does NOT work! my $grammar = qr{ ($RE{delimited}{ -delim => q{'} }{ -esc=>q{'}}) }; =cut my $pattern=''.$RE{delimited}{ -delim => q{'} }{ -esc=>q{'}}; my $grammar = qr{ $pattern }; if (q{'some string with containing a '''} =~ $grammar) { warn Data::Dumper->new([\%/],[qw(*/)])->Deepcopy(1)->Indent(1)->Maxdepth(3)->Sortkeys(1)->Dump(),q{ }; };