Given the code snippet bellow I need to extract each Place Name & Coord string
There might be zero 1 or many however I can't be sure what the delimiter will be when there are multiple the two samples are either a comer or semi colon
I do know
Place Name (Coord string) are in this format
print "Hello World!\n";my @examples=("Place Name (Coord string )","Place Name2 (Coord string 2);Place Name3 (Coord string 3);Place Name4 (Coord string 4)","Place Name5 (Coord string 5), Place Name5 (Coord string 5),Place Name6 (Coord string 6)","Not Wanted");foreach my $example (@examples){ if($example =~ m/(.*)\((.*)\)([,;])?/g){ my $Place =$1; my $Coord = $2; # do stuff with each print "$Place $Coord\n"; }}
Open in new window
That would match groups of characters excluding the delimiter.