Regex Samples: Difference between revisions
Line 59: | Line 59: | ||
[[Category:Index]] | [[Category:Index]] | ||
[[Category:Tools]] |
Revision as of 16:12, 17 February 2015
Regex Samples Figures 1
Always be precise in the way you specify your data. The following question can be multiple interpreted.
Create a regular expression that matches the figures:
- 1 - 49
- 01 - 49
Of course the ^[0-4]?[0-9] is much too simple.
![]() |
![]() |
![]() |
![]() |
Regex Samples Figures 1
Always be precise in the way you specify your data. The following question can be multiple interpreted.
Create a regular expression that matches the figures:
- 25 - 67
![]() |
![]() |
Regex Email Address
Always be precise in the way you specify your data. The following question can be multiple interpreted.
Create an email checker for input validation of an email.
![]() |
Please note that not all strange entries will work. There seems to exist an email address with the top level domain name museum.
If you want to validate such addresses to than you have to use something like:
|
There is an Official Standard: RFC 5322 regex for email addresses, but alas also not full proof. Here it is:
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)* | "(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f] | \\[\x01-\x09\x0b\x0c\x0e-\x7f])*") @ (?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
| \[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3} (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]: (?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f] | \\[\x01-\x09\x0b\x0c\x0e-\x7f])+) \])
.
Also not full proof.
See also
Reference
- ↑ Regular Expressions, This example of the email checker is discussed in more details on the webpage of Jan Goyvaerts.