in reply to \G inline RegEx operator
use strict; use warnings; use Data::Dumper; my $kmlfile = <<'EOD'; <coordinates>1.0001,2.0002,0 3.0003,4.0004,0 5.0005,6.0006,0 7.0007,8.0008,0 9.0009,10.0010,0 </coordinates> EOD my $rxCoord = qr {(?x) (?<=\s|>) (\d*\.\d*,\d*\.\d*) (?=,0) }; my @coords = $kmlfile =~ m{$rxCoord}g; print Data::Dumper->Dumpxs( [ \ @coords ], [ q{*coords} ] );
The output.
@coords = ( '1.0001,2.0002', '3.0003,4.0004', '5.0005,6.0006', '7.0007,8.0008', '9.0009,10.0010' );
I hope this is of use.
Cheers,
JohnGG
|
|---|