use strict;
my $str = '0: 0,Ù ,Û°,߀,०,০,੦,૦,à¦,௦,౦,೦,൦,à¹,à»,༠,á€,á‚,០,á ,᥆,á§,á,á®°,á±€,á±,ê˜ ,ê£,꤀,ê©,ï¼
1: 1,Ù¡,Û±,ß,१,à§§,à©§,à«§,à§,௧,à±§,à³§,൧,๑,໑,༡,á,á‚‘,១,á ‘,᥇,á§‘,á‘,á®±,á±,᱑,꘡,꣑,ê¤,ê©‘,1
2: 2,Ù¢,Û²,ß‚,२,২,੨,૨,à¨,௨,౨,೨,൨,๒,à»’,༢,á‚,á‚’,២,á ’,᥈,á§’,á’,᮲,᱂,á±’,꘢,꣒,꤂,ê©’,ï¼’
3: 3,Ù£,Û³,߃,३,à§©,à©©,à«©,à©,௩,౩,೩,൩,๓,໓,༣,áƒ,á‚“,៣,á “,᥉,á§“,á“,᮳,᱃,᱓,꘣,꣓,꤃,ê©“,3
4: 4,Ù¤,Û´,ß„,४,৪,੪,૪,àª,௪,౪,೪,൪,๔,à»”,༤,á„,á‚”,៤,á ”,᥊,á§”,á”,á®´,᱄,á±”,꘤,꣔,꤄,ê©”,ï¼”
5: 5,Ù¥,Ûµ,ß…,५,à§«,à©«,à««,à«,௫,౫,೫,൫,๕,໕,༥,á…,á‚•,៥,á •,᥋,á§•,á•,᮵,á±…,᱕,꘥,꣕,꤅,ê©•,5
6: 6,Ù¦,Û¶,߆,६,৬,੬,૬,à¬,௬,౬,೬,൬,๖,à»–,༦,á†,á‚–,៦,á –,᥌,á§–,á–,á®¶,᱆,á±–,꘦,꣖,꤆,ê©–,ï¼–
7: 7,Ù§,Û·,߇,à¥,à§,à©,à«,à,à¯,à±,à³,àµ,๗,à»—,༧,á‡,á‚—,៧,á —,á¥,á§—,á—,á®·,᱇,á±—,꘧,꣗,꤇,ê©—,ï¼—
8: 8,Ù¨,Û¸,߈,८,à§®,à©®,à«®,à®,௮,à±®,à³®,൮,๘,໘,༨,áˆ,႘,៨,á ˜,᥎,᧘,á˜,᮸,᱈,᱘,꘨,꣘,꤈,꩘,8
9: 9,Ù©,Û¹,߉,९,৯,੯,૯,à¯,௯,౯,೯,൯,๙,à»™,༩,á‰,á‚™,៩,á ™,á¥,á§™,á™,᮹,᱉,á±™,꘩,꣙,꤉,ê©™,ï¼™';
my $regex = qr/\d/up;
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