|
php regular expressions summary: |
Explanation: |
| ^ | Start of String |
| $ | End of string |
| n* | Zero or more of 'n' |
| n+ | One or more of 'n' |
| n? | An optional 'n' |
| n{3} | Exactly three of 'n' |
| n{3,} | At least 3 or more of 'n' |
| n{3,6} | From 3 to 6 of 'n' |
| () | Parenthesis to group expressions |
| (a|z) | Either 'a' or 'z' |
| . | Any single character |
| \\. | The period '.' |
| \\\ | The backslash '\' |
| [1-9] | A number between 1 and 9 |
| [a-z] | A lower case character between a and z |
| [A-Z] | An upper case character between A and Z |
| [^a-z] | Absence of lower case a to z |
| [_a-zA-Z] | An underscore or any letter of the alphabet |
| ^([a-zA-Z0-9_]|\\-|\\.)+@(([a-zA-Z0-9_]|\\-)+\\.)+[a-zA-Z]+$ | Ex: Used to verify valid e-mail address field format A string beginning with any alphabet (a-z, A-Z) or number (0-9) or underscore or hyphen or period (user-name field) followed by the @ sign followed by any alphabet (a-z, A-Z) or number (0-9) or underscore or hyphen (domain-name field) followed by a period followed by any alphabet (a-z, A-Z) (top-level-domain field) end of string |
| ^([a-zA-Z0-9_]|\\-|\\.)+@(([a-zA-Z0-9_]|\\-)+\\.)+[a-zA-Z]{2,4}$ | Ex: e-mail address field format for 2-4 character top-level-domain name This would work for top-level-domain names such as .us, .uk, .com, .info, .name, .coop, etc. But with the new top-level-domain name such as .museum, .family, it won't work. |
| ^.{3}[a-z]{1,3}_?[0-9]*([2-7]|[a-f])[^1-9]{2}a+$ | A string beginning with any three characters followed by from 1 or 3 lower case alphabet letters followed by an optional underscore followed by zero or more digits of 0-9 followed by either a number between 2 and 7 or a character between a and f (lowercase) followed by a two characters which are not digits between 1 and 9 followed by one or more characters of a end of a string |
Copyright © 2003 Computational Neural Systems
Inspired by The Personal Best