^-?([0-8]?[0-9]|90)(\.[0-9]{1,10})$
- 56.3847
- -56.387
- 3
- 30
- 300
- 91.34456
- 40.238946234652374238746
^-?([0-9]{1,2}|1[0-7][0-9]|180)(\.[0-9]{1,10})$
- 56.3847
- -56.387
- 91.34456
- 127.485784
- -130.37567
- 3
- 30
- 300
- 40.238946234652374238746
- 181.394898
^-?([0-8]?[0-9]|90)(\.[0-9]{1,10})?$
- 3
- 30
- 56.3847
- -56.387
- 300
- 91.34456
- 40.238946234652374238746
^-?([0-9]{1,2}|1[0-7][0-9]|180)(\.[0-9]{1,10})?$
- 3
- 30
- 56.3847
- -56.387
- 91.34456
- 127.485784
- -130.37567
- 300
- 40.238946234652374238746
- 181.394898
Note: This RegEx matches to coordinates upto 10 decimal places accurate. To increase or decrease the accuracy change the 10
to your desired accuracy in the last {1,10}
.
Hi!
I've tried using your patterns with a slight change in the decimal precision, as such:
I'm using these two constants to validate inputs in 2 form controls in Typescript:
For some reason, regardless of the patterns I use, the online compilers for regex patterns validate and invalidate correctly any examples I provide, whereas, in my form, the fields trigger errors for examples like:
Do you have any idea why this is?