use strict;
my $str = '<p><style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style><span style="font-size:10pt;font-family:Calibri, Arial;" data-sheets-value="{"1":2,"2":"When doing a Future trade workflow, and selecting this Future asset to be traded on, a vos displayed showing that the Futures Type (which is the asset subtype) does not have Geneva ID on it. After some investigation, turns out that the actual Futures subtype list does not contain the list item \\"Physical index future.\\", which is currently showing for Asset ID 3175, as seen in attached Picture 2. "}" data-sheets-userformat="{"2":13249,"3":{"1":0},"9":0,"10":0,"11":4,"12":0,"15":"Calibri","16":10}">When doing a Future trade workflow, and selecting this Future asset to be traded on, a vos displayed showing that the Futures Type (which is the asset subtype) does not have Geneva ID on it. After some investigation, turns out that the actual Futures subtype list does not contain the list item "Physical index future.", which is currently showing for Asset ID 3175, as seen in attached Picture 2</span></p>';
my $regex = qr/((?<=\s)data-[^="]+?=".+(?=["]\s)")|((?<=\s)(?:data-[^=]+?)=".+?(?=>))|((?<=\s)(?:data-[^=]+?)="[^>]+?(?=>))/p;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html