I think others have already given a good answer. Aside, if this is not something to parse the markup, then you can increase the functionality on the line side with something like this:
\s+ col \s* = \s* "( (?: \\. | [^\\"]+ )* )"
Perl'ish will be:
use strict; use warnings; my $regex = qr/ \s+ col \s* = \s* "( (?: \\. | [^\\"]+ )* )" /sx; my $string = q( col = " this'' is \" a test\s, of the emergency broadcast system, alright .\". cool." ); if ( $string =~ /$regex/ ) { print "Passed val =\n $1\n"; } __END__ Passed val = this'' is \" a test\s, of the emergency broadcast system, alright .\". cool.
source share