use strict;
my $str = '// Resources for SEEN0001.TXT
#character \'美佐枝\'
#character \'春原\'
#character \'ボタン\'
<0000> \\{美佐枝}You little goblin...
<0001> Unable to contain her fury, Misae grabs both of Sunohara\'s legs...
<0002> \\{春原}Heh?
<0003> ...and proceeds to use her killing move, The Giant Swing.
<0004> \\{美佐枝}Uryaaaaaaaaaaaaaaaaaaa!
<0005> \\{春原}Uwaaaaaaaaaaaaaah!
<0006> \\{ボタン}Puhiiii.
<0007> \\{春原}Uwaaaaaaaaaaah!
<0008> \\{春原}Uwaaaaaaaaaaah!
<0009> \\{春原}Uwaaaaaaaaaaah!
<0010> \\{春原}Geeh!
<0171> \\size{intA[1001]}*BOOM*\\size{}\\shake{4}
<0145> \\size{intA[1001]}Dammit! Stupid rugby players!!\\size{}
';
my $regex = qr/^(.*.+)$/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