Regular Expressions

Operator Description Example Matches Fails
. Any one character except newline . k  
^ Start of string ^T ^Train Car
$ End of string t$ Artist Train
[chars] Any character between the square brackets [xyzXYZ] Y A
[char range] Any character in the range [a-zA-Z] R 8
\d Any single numeric digit. Shortcut for [0-9] \d\d\d 456 Car
\w Any alphanumeric character or underscore. Shortcut for [a-zA-Z0-9_] \w\w\w Bus 60%
\s Space \d\s\d 1 3 123
* Previous charcter may occur zero or more times. joy*car jocar jcar
+ Previous charcter may occur once or more times joy+car joyycar car
? Previous charcter may occur once or not at all boats? boat boa
{number} Number of repititions of previous character or string. Curly brackets around number \d{3}

(Hi J.){2}

Hi J.Hi J.
45 34

Hi K.

Regular Expression Tester


Enter Expression in left hand box and String to be tested in the right hand box.

Results can be seen in the Alert box at the top of the page.

(c) Created by B V Wood.

To add an entry or comment on the article, please fill in the comments form

Return to Top

Main Index

  Main Index