Skip to content

Search using Regex

Special Regex Characters

These characters have special meaning in regex: . + * ? ^ $ ( ) [ ] { } | \ To escape these characters, use preceding the character. For example, \* matches a star and does not perform the function mentioned below.

Basics of Regular Expressions

Character What does it do Example Matches
^ Matches beginning of line \^abc abc, abcdef.., abc123
$ Matches end of line abc\$ my:abc, 123abc, theabc
. Match any character a.c abc, asg, a2c
| OR operator abc|xyz abc or xyz
(...) Capture anything matched (a)b(c) Captures 'a' and 'c'
[...] Matches anything contained in brackets [abc] a, b, or c
[^...] Matches anything not contained in brackets [\^abc] xyz, 123, 1de
[a-z] Matches any characters between \'a\' and \'z\' [b-z] bc, mind, xyz
[0-9] Matches any digit between 0 and 9 [5-9] 56, 9, 789
{x} The exact \'x\' amount of times to match (abc){2} abcabc
{x,} Match \'x\' amount of times or more (abc){2,} abcabc, abcabcabc
{x,y} Match between \'x\' and \'y\' times (a){2,4} aa, aaa, aaaa
* Matches the character before the ? zero or one time ab*c abc, abbcc, abcdc
+ Matches character before + one or more times a+c ac, aac, aaac
? Matches the character before the ? zero or one time ab?c ac, abc