use strict;
my $str = 'PENCARROW COMPOSITE ROLL
178 Wellington Rd, Wainuiomata,Hmmkr ...8 Bull Avenue, Wainuiomata,Housewife ..3/40A Bauchop Rd,Lower Hutt,Scrtry ..26 Castlerea Street, Wainuiomata,Printer 126 Cheviot Rd,Lowry Bay, Hawt
.8 Bull Avenue, Wainuiomata,System Oprtr 144 Cambridge Terrace, Lower Hutt, Butcher 144 Cambridge Tce,Lower Hutt, Housewife ..12 Collingwood St.Lower Hutt,Housewife 12 Collingwood Street, Lower Hutt, Welder ..32 Moohan Street, Wainuiomata,Storeman 8 Burden Avenue, Wainuiomata,Pub Servant .....21 Pollard St,Wainuiomata,Machine Optr 32 Burnside Street, Lower Hutt, Press Wrkr
8 Burden Avenue, Wainuiomata, Pub Servant
3 Manurewa Gr.Wainuiomata, Technician
26 Mimihau Grove, Wainuiomata, Shop Proptr';
my $regex = qr/(\d+[^0-9]+)(?!\d)/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