in reply to Need help using regex to extract multiple matches
G'day SergioQ,
You capture multiple matches with a regex by using the 'g' modifier.
Example code:
#!/usr/bin/env perl use strict; use warnings; my $string = '... data-src-hq="qwe" ... ' . '... data-src-hq="asd" ... ' . '... data-src-hq="zxc" ...'; my @matches = $string =~ /data-src-hq="([^"]+)"/g; print "@matches\n";
Output:
qwe asd zxc
— Ken
|
|---|