And the obligatory variation using the \K operator (see Lookaround Assertions in Extended Patterns in perlre) introduced in Perl version 5.10:
c:\@Work\Perl\monks>perl use 5.010; # needs perl version 5.10+ for \K operator use strict; use warnings; my $string = '... data-src-hq="qwe" ... ' . '... data-src-hq="asd" ... ' . '... data-src-hq="zxc" ...'; my @matches = $string =~ m{ data-src-hq=" \K [^"]+ (?= ") }xmsg; print map "'$_' ", @matches; __END__ 'qwe' 'asd' 'zxc'
Give a man a fish: <%-{-{-{-<
In reply to Re: Need help using regex to extract multiple matches
by AnomalousMonk
in thread Need help using regex to extract multiple matches
by SergioQ
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |