Regex Tester
Check what a regular expression does and what it finds, or find one from examples.
Runs in your browser · nothing is sent
Start by typing a pattern in step 1, or open “Load example” in step 2.
- Pick a mode above.
- Type or build a pattern, then add some text.
- Read what it does, then copy it as JS, Python or Splunk.
Your pattern
More options
Build with blocks
- Add: click a block below (or drag it into place). It goes after the block you selected.
- Repeat: repeat blocks like + * ? {n} act on the block right before them. Example: \d then {4} = four digits.
- Edit: select a block in your pattern to change, move or remove it.
The pattern field above and the blocks always match: type in either one.
No blocks yet. Click a block below, or start from an example:
Matches are highlighted in the text and numbered. The full list is under Result.
- Match (underlined, with its number)
- Dashed outline: found by several patterns (Advanced)
What your pattern does
- Position
- Characters
- How many
- Group / either-or
- Escaped character
- Exact text
Result
0 matches$1 … $n = numbered group, $<name> = named group, $& = the whole match, $$ = a real dollar sign.
Cuts the text wherever the pattern matches. Text caught by a group ( ) is kept as its own part.
0 parts
Advanced: test several patterns at once
Pattern boxes
Each box is a pattern tested on the same text and highlighted in its own colour. Select a box to edit it in step 1; drag the handle or use ↑ ↓ to reorder. The share link holds the patterns only, never your text.
Common patterns
Should match
Examples the pattern must find. One per row; pasting several lines adds a row each.
Should NOT match (optional)
Near misses the pattern must skip. They make the suggestions stricter.
Pick a pattern
Add at least one example you want to find. Suggestions appear here as you type.
In plain words
Suggestions only know your examples. Always test the pattern on real text before you rely on it.
Regex quick reference
Characters
.any character except a line break (all, with “Dot matches new line”)\da digit 0-9 ·\Dnot a digit\wa letter, digit or _ ·\Wanything else\sa space, tab or line break ·\Sanything else[abc]one of a, b, c ·[^abc]any other character\.a real dot (a backslash makes a symbol literal)
How many
*0 or more ·+1 or more ·?0 or 1{n}exactly n ·{n,}n or more ·{n,m}n to m- Add
?after any of these to take as few as possible
Position
^start ·$end (of each line with “^ $ per line”)\ba word edge ·\Bnot a word edge(?=x)followed by x ·(?!x)not followed by x(?<=x)right after x ·(?<!x)not right after x
Groups
(abc)group, saved as $1, $2 …(?<name>abc)group saved by name(?:abc)group, not saveda|beither a or b ·\1the same text as group 1 again