use strict;
my $str = ' <button type="button" *ngIf="holerite.arquivo" class="btn btn-link btn-crud-list datalist-button"
(click)="download(holerite.arquivo)" [pTooltip]="\'entity.action.download\' | translate"
tooltipPosition="top">
<span class="fa fa-download fa-lg"></span>
</button>
<button type="button" class="btn btn-link btn-crud-list datalist-button" (click)="delete(holerite.id!)"
[pTooltip]="\'entity.action.delete\' | translate" tooltipPosition="top">
<span class="fa fa-trash fa-lg"></span>
</button>
<button>AAhhh</button>
';
my $regex = qr/<button[^>]*>\n\s*<span .*<\/span>\n\s*<\/button>/mp;
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