I would like to verify a coordiantes-entry with a RegEx that will accept coordinates in the decimal format as well as in degrees/minutes/seconds.
I came as far as you can see below. It works with the degree/minutes/seconds-input but fails to identify the latitude in the decimal format, the longitude is correct:
Input e. g.:
48.20801690888307, 16.371340225941758 or
N 48° 12′ 28.0044 E 16° 22′ 17.1588
(?:([0-8]?[0-9]|90)°(s[0-5]?[0-9]’)?(s[0-5]?0-9?”))|((?:w?s?[0-9]{1,3})(?:.?,?[0-9]+)s?w?)$
I tried to find the mistake, but stranded at this point. I would be grateful for every help,
Thanks!
Eva Zecha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.