Hi,

I am writing a couple of regex values to validate for valid longitude values that should fall within a specific range , and so far i got the general syntax ok

for longitudes , my regex is as follows:
[-]?3[1-7]*[.]{0,1}[0-9]{0,6} 

i.e  an optional negative sign followed by a number in the range 31-37 , followed by an optional decimal point, and if there is a decimal point then  a set of numeric character to a max of 6 characters.

When i run the regex on some test values i get the following results
-31.00000000  TRUE
31.00000000 TRUE
-37.999999999 TRUE
37.999999999  TRUE
-36.744uiu82    TRUE ( but should be false.; it truncates the characters to return a true on -36.744)
36.744uiu82      TRUE ( but should be false.; it truncates the characters to return a true on 36.744)
-3sers6.744uiu82  TRUE ( but should be false.; it truncates the characters to return a true on -3)
3sers6.744uiu82   TRUE ( but should be false.; it truncates the characters to return a true on 3)

28.90909  FALSE (does not fall in range)
-28.90909  FALSE (does not fall in range)

My problem is with the values in the text highlighted . Obviously 36.uoiuy5656 is not a valid value since in its entirety it contains a mix of non-numeric values

What am i doing wrong  or missing  here?  I am not well versed with greedy or backreferenced syntax. Any assitance would be greatly appreciated.


Kind regards

Kiti Chigiri