I'm trying to create a regular expression for matching latitude/longitude coordinates. For matching a double-precision number I've used (\-?\d+(\.\d+)?)
, and tried to combine that into a single expression:
^(\-?\d+(\.\d+)?),\w*(\-?\d+(\.\d+)?)$
I expected this to match a double, a comma, perhaps some space, and another double, but it doesn't seem to work. Specifically it only works if there's NO space, not one or more. What have I done wrong?