Mark Jacobs' Regular Expression Tester

Regular Expression :-

Search String :-


Result from string function 'search' :- 

Result from RegExp function 'test' :-   

Regular Expression Syntax

Time Savers
 \w	Match a "word" character (alphanumeric plus "_")
 \W	Match a non-word character
 \s	Match a whitespace character
 \S	Match a non-whitespace character
 \d	Match a digit character
 \D	Match a non-digit character
 .	Match any character (except newline)
Pattern Repeat Specifiers
 *	Match 0 or more times (equivalent to {0,})
 +	Match 1 or more times (equivalent to {1,})
 ?	Match 1 or 0 times    (equivalent to {0,1})
 {n}	Match exactly n times
 {n,}	Match at least n times
 {n,m}	Match at least n but not more than m times
Special Characters
 \	Treat next character as literal, for example \. \\ \$ \^ \|
 \t	Tab
 \f	Form Feed
 \r	Carriage Return
 \n	Line Feed
 \xHH	HH are 2 hex digits specifying the character code
 ^	Match the beginning of the line
 $	Match the end of the line (or before newline at the end)
 \b	Match word boundary
 \B	Match non-word boundary
 |	Alternation
 ()	Grouping
 []	Character class (match any one of these characters)
 [^]	Exempt Character class (match anything but one of these characters)
Examples
 E-mail Address Validator  ^[\w.'-]+@[\w-]+\.([\w.-]+\.\w{2,3}|\w{2,3})$
 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

 \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]

Back to Maths Page
Back to Main Page