What are Regular Expression?
Regular expressions are a series of special characters that looks like your cat has walked over your keyboard.
For example /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/
What the above does is match email adresses from a given string (block of text) using a set pattern.
Regular Expressions can be difficult to learn but it's worth the effort. Using regular expressions can save you loads of time if you need to do a lot of text manipulation.
Use the above form to test your regular expressions. Either enter your own into the space provided or select a pre defined one from the list. Enter the thect you want to search into the textarea and click on the TestExpression button.
Some Special Characters and their meaning^ | Start of a line |
$ | End of a line |
. | Any character except for newline character (if used without parameter " /.../s") |
[ ... ] |
Match any characters between the [] |
[^ ... ] | Doesn't Match any of the characters between the [] |
\# |
Escape spaecial characters to use as literal for example, $ is a special character if you want to match a $ in your text escape it with a backslash \$ |
\b | Word boundary -
|
\B | Non word Boundary -
|
\n | Match linefeed or new line character |
\r | Match Carriage Return |
\t | Match Tabs |
\s | A whitespace character (tab/space /cr/lf) |
\S | Not a whitespace character |
\w | Match a word character - letters digits and underscore |
\W | A non-word character - including spaces |
\d | A digit |
\D | Not a digit |