E-mail Address Validator ^[\w.'%+-]+@([\w-]+\.)+[A-Za-z]{2,4}$
UK Postcode Validator ^[A-Za-z]{1,2}\d{1,2}[A-Za-z]? \d[A-Za-z]{2}$
[abc] meaning match a b or c, and [^abc] for match not a b or c
[0-3] meaning match 0 1 2 or 3, and [^0-3] for match not 0 1 2 or 3
[03-] meaning match 0 3 or -, and [^03-] for match not 0 3 or -
[aeiou]{5} meaning match a sequence of exactly 5 lowercase vowels
(cat|dog|kid)nap would match catnap, dognap or kidnap
\w is equivalent to [A-Za-z0-9_]
\W is equivalent to [^A-Za-z0-9_]
\s is equivalent to [ \t\n\r\f]
\S is equivalent to [^ \t\n\r\f]
\d is equivalent to [0-9]
\D is equivalent to [^0-9]
By default, text matching is ungreedy, that is, it returns the minimum number of characters
that match the regular expression. To change this behaviour so that the maximum number of
characters matching an expression are returned, prefix the expression with (?-U). For example,
edwardwoodward@japanco.org
when tested against [\w.'%+-]+@([\w-]+\.)+[A-Za-z]{2,4} gives edwardwoodward@japanco.or
when tested against (?-U)[\w.'%+-]+@([\w-]+\.)+[A-Za-z]{2,4} gives edwardwoodward@japanco.org
Flags can appear anywhere in a pattern and take effect from that position onwards. They work as follows :-
(?i) turn on case insensitivity (usually the default)
(?-i) turn off case insensitivity
(?m) turn on multi-line matching where the ^ and $, the "start of line" and "end of line"
constructs, match immediately following or immediately before any newline in the subject
string, respectively, as well as at the very start and end (default)
(?-m) turn off multi-line matching
(?s) make the dot character (.) match newlines as well as all other characters
(?-s) make the dot character (.) not match newlines, but match all other characters (default)
(?x) ignore white space characters in the pattern
(?-x) do not ignore white space characters in the pattern (default)
(?U) match a minimum amount of characters (default)
(?-U) match a maximum amount of characters
|