by Brian DeMarzo, April 11, 2001
Want to test a regular expression? Type the regular expression pattern (without the beginning and ending forward slashes), choose the pattern checking modifiers (global and ignore-case), type the string you want to check your regular expression against, and click the Search button for the results!
Ref: Marzie's ToolBoxInterpretation of Special Character Strings
| ^ | Match the expression at the beginning of the line |
| $ | Match the expression at the end of the line |
| \ | Escape the special meaning of the next character |
| - | Indicates a range when not in the first/last position. When specifying a range with the "[" and "]", to specify a list. |
| | | Union of regular expressions |
| [LIST] | Match a Single Character specified in the list. |
| [^LIST] | Don't match a single character specified in the list. |
| . | Match any single character (including non-printable ones). |
| * | Repeat the previous regular expression 0 or more times. |
| + | Repeat the previous regular expression 1 or more times. |
| ? | Repeat the previous regular expression 0 or 1 times. |
| () | Groups regular expression. |
| Ref: Regular Expressions Additional Documentation | |
Useful regular expressions
| Validation | |
| Email x@x.xx | /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/ |
| IP xxx.xxx.xxx.xxx | /^(([01]?\d\d?|2[0-4]\d|25[0-5])\.){3}([01]?\d\d?|2[0-4]\d|25[0-5])$/ |
| Date yyyy-mm-dd | /^\d{2,4}(\/|-|.)(0?\d|[01][012])(\/|-|.)(0?\d|[012]\d|[3][01])$/ |
| Stripping | |
| HTML Tags(1) | /<TagName[^>]*>/ |
| HTML Tags(2) | /<TagName[^>]*>.*</TagName>/ |
| IMG To Text | /<img src=\".*\" alt=\"(.*)\">/i (NOTE: Doesn't work) |