# Regular expressions

With regular expressions, you can search for text by applying patterns instead of an exact text string to search for.

Beginning of line | ^ | Matches a line start.
End of line | $ | Matches a line end.
Any character | . | Matches any single character.
Zero or more | * | Matches zero or more of the preceding expression. Example: ta* matches t, ta and taa. t(ab)* matches t, tab and tabab.
One or more | + | Matches one or more of the preceding expression. Example: ta+ matches ta, taa and taaa.
Set of characters | [] | Matches any of the characters within the brackets. Example: t[ab] matches ta and tb.
Not in set | [^] | Matches any characters not within the brackets (following the '^'. Example: t[^ab] matches tc and td, but not ta or tb.
Or | | | Matches the expression before or after the '|'. Example (ta)|(tb) matches ta or tb, but not tc.
Grouping | () | Groups a subexpression.
Nth subexpression | \N | Each group ('(expression)') gets an order number from 1 to 9. 0 is the whole expression. When replacing, the text matching the Nth expression from the found text is inserted. Example: t(a)|(b) should be replaced with u\1. In the text "ta", the replacement will result in "ua", and in the text "tb" the replacement will result in "ub".
Character code | \nnn or \xnn | Inserts or searches for the decimal character code nnn or the hexadecimla character code xnn.
Alphabetic string | :a | Equivalent to [a-zA-Z].
Uppercase alphabetic string | :u | Equivalent to [A-Z].
Lowercase alphabetic string | :l | Equivalent to [a-z].
Numeric string | :n | Equivalent to [0-9].
Alphanumeric string | :m | Equivalent to [a-zA-Z0-9].
Space character | :s | Equivalent to [\032\009].