I'm looking for a regular expression to detect invalid floating point numbers in the sense that they cannot have two decimal points. Here is what I have, but it's not working:
REAL = re.compile("^\d+\.\d+$")
Edit: I'm using python. In the big picture I'm writing a lexer to recognize a miniature version of the C syntax. A 2.3.4 is recognized as invalid, but a 13.4.5 is not. It has something to do with that, I suppose.
Sorry for the poorly formatted question. After reading through some comments I found the error elsewhere in the code. Turns out that using re.compile("0") and re.compile("1")
earlier in my code was causing any sequence starting with a 1/0 to be 'picked up' as valid, despite whatever the remainder of the sequence. Simply adding "0$" and "1$"
fixed my problem.