use strict;
my $str = '"110.94m2・129.24m2";
--> 110.94m2 and 129.24m2
"81.95m2(24.78坪)、うち2階車庫8.9m2"
--> 81.95m2
"80.93m2(登記)"
--> 80.93m2
"93.42m2・93.85m2(登記)"
--> 93.42m2 and 93.85m2
"81.82m2(実測)"
--> 81.82m2
"81.82m2(実測)、うち1階車庫7.82m2"
--> 81.82m2
"90.11m2(実測)、うち1階車庫8.07m2"
--> 90.11m2';
my $regex = qr/(?<![\u4E00-\u9FAF\u3040-\u3096\u30A1-\u30FA\uFF66-\uFF9D\u31F0-\u31FF])(?<!\d)(?<!\d\.)(\d+(?:\.\d+)?m2)/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