in reply to regex for strings with escaped quotes
use Regexp::Common qw/delimited/; my $str = q{ x "foo \"bar\"" y }; $str =~ /($RE{delimited}{-delim=>'"'})/; print $1, "\n"; print $RE{delimited}{-delim=>'"'}, "\n"; __END__ "foo \"bar\"" (?:(?|(?:\")(?:[^\\\"]*(?:\\.[^\\\"]*)*)(?:\")))
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex for strings with escaped quotes
by morgon (Priest) on Feb 12, 2019 at 15:52 UTC | |
by haukex (Archbishop) on Feb 12, 2019 at 15:55 UTC | |
by morgon (Priest) on Feb 12, 2019 at 16:35 UTC | |
by haukex (Archbishop) on Feb 12, 2019 at 16:47 UTC | |
by morgon (Priest) on Feb 12, 2019 at 17:11 UTC | |
|
Re^2: regex for strings with escaped quotes
by morgon (Priest) on Feb 12, 2019 at 15:17 UTC | |
by haukex (Archbishop) on Feb 12, 2019 at 15:19 UTC | |
by morgon (Priest) on Feb 12, 2019 at 15:24 UTC |