You are viewing a single comment's thread. Return to all comments →
Perl
while(<>){ if ($. == 1){ next; } if( /\((?<LAT>[\-\+]?[1-9]\d?(?:\.\d+)?),\s(?<LON>[\-\+]?1?\d{0,2}(?:\.?\d+))\)/ ){ my $LAT = $+{LAT}; my $LON = $+{LON}; ($LAT >= -90 && $LAT <= 90 && $LON >=-180 && $LON <=180) ? print "Valid\n" : print "Invalid\n"; } else { print "Invalid\n"; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Detecting Valid Latitude and Longitude Pairs
You are viewing a single comment's thread. Return to all comments →
Perl