Regular expressions#


Square brackets define a list or range of characters to search for:


corresponds to a, b or c


corresponds to any lower case letter


corresponds to each letter


corresponds to any letter or digit



corresponds to a single character


corresponds to zero or more times the preceding element, for example colou*r matches color, colour, colouur etc.


corresponds to zero or once the preceding element. colou?r matches color and colour.


matches the previous element one or more times, for example .+ matches ., .., ... etc.


corresponds N times to the preceding element.


matches the previous element N or more times.


corresponds at least N times to the preceding element, but not more than M times.



puts the position at the beginning of the line.


puts the position at the end of the line.

Escape characters and literals#


is used to search for a special character, for example to find .org you have to use the regular expression \.org because . is the special character that matches every character.


matches every single digit.


matches any part of a word character and is equivalent to [A-Za-z0-9].


matches any space, tab or newline.


matches a pattern on a word boundary.