Rather than rewrite what is already on many websites such as this one, I'm simply going to post some regular expressions that you may find useful for things such as form validation and file parsing.
You may notice that some of these are really long. This is because they are rather strict when matching valid values. To see why by example, select a tab in the demo below.
This script was successfully tested in Windows versions of Internet Explorer 5.5 - 7, Firefox 1.5 - 3, Opera 9 and Safari 3.
| Positive Integer Values | Positive Decimal Values | Positive Integer and Decimal Values | Signed Integer and Decimal Values | Signed Floating Point Numbers |
|---|
As I could not test the infinite number of possible values that could be passed into each of these expressions, there is the off chance that some values may test as true when they shouldn't and vice versa. If you happen to come across such a value, please let me know. Thanks!
Comments