The regex approach cannot really confirm that longitude and latitude are valid, but here is one that would be more accurate than others already published:
/^\s*-?\d{1,3}\.\d+,\s*\d{1,3}\.\d+\s*$/
This will reject some lines that other solutions will allow, for example
-1-23-1-,210- --123.1234,123.1234
But he would still have invalid values:
361.1234, 123.1234
Your best bet - if you need a serious check - is to create a class to store and check these coordinates.
source share