http://qs321.pair.com?node_id=1229802


in reply to Re: regex for strings with escaped quotes
in thread regex for strings with escaped quotes

thanks, but I forgot to mention one detail:

I do not need this for a perl-program but for a perl5-compatible regex engine in Go.

I there a way to print the regex that is used?

  • Comment on Re^2: regex for strings with escaped quotes

Replies are listed 'Best First'.
Re^3: regex for strings with escaped quotes
by haukex (Archbishop) on Feb 12, 2019 at 15:19 UTC
    I there a way to print the regex that is used?

    That's what the second line of output above is. Simplification of that regex is left as an exercise to the reader :-) (Update: Nevermind.)

    BTW, you can also use the -keep feature to get only the part between the quotes:

    use Regexp::Common qw/delimited/; q{ x "foo \"bar\"" y } =~ /$RE{delimited}{-delim=>'"'}{-keep}/; print $3, "\n"; # prints: foo \"bar\"
      Many thanks.

      This is exactly what I need - let's see if I can feed that to the go-engine...