Regex Tester Online Free: Test Regular Expressions
A regular expression that works on the first try is rare. You write a pattern, run it, and it matches too much, too little or nothing at all. The PDFFlowState Regex Tester lets you try patterns against sample text in your browser, for free, with no account.
What does Regex Tester do?
Regex Tester tests patterns against sample text. Use it as a regex tester online or regex online tool to check regular expression patterns before you put them in your code. People also search for it as regex tool, regex editor, regex builder online and regex creator.
How to test a regular expression
- Open the tool. Go to Regex Tester. It works on phone and desktop.
- Enter your pattern.
- Paste your sample text.
- Check the matches. Adjust the pattern until it matches exactly what you want.
No sign-up is needed, so it is a free way to test regex.
Regex cheat sheet
| Pattern | Meaning |
|---|---|
. |
Any character except a new line |
\d |
A digit (0-9) |
\w |
A letter, digit or underscore |
\s |
A whitespace character |
^ and $ |
Start and end of the text |
* |
Zero or more of the previous item |
+ |
One or more of the previous item |
? |
Zero or one of the previous item |
{3} or {2,4} |
An exact count, or a range |
[abc] |
One of the characters a, b or c |
(...) |
A group |
a|b |
Either a or b |
Examples
\d{3}-\d{4}matches a number like 555-1234.^[A-Z]matches text that starts with a capital letter.\bcat\bmatches the whole word "cat" but not "category".
Tips for writing better regex
- Start small. Build the pattern up piece by piece and test as you go.
- Be specific.
.*matches almost everything, which often causes surprises. - Escape special characters such as
.and?with a backslash when you mean the literal character. - Test edge cases: empty text, extra spaces and unexpected characters.
- Clean your sample text with Text Formatter, and compare results with Diff Checker.
Related tools
- Format the JSON you are matching with JSON Formatter.
- Count characters and lines with Text Counter.
- Generate test IDs with UUID Generator.
Frequently asked questions
Is the regex tester free? Yes. It is free and needs no sign-up.
Does it generate a regex for me? No. It tests patterns you write. It does not build them from a description.
Does regex work the same in every language? Mostly, but details differ between languages such as JavaScript, Java, C# and Ruby. Always test your pattern in the language you will actually use it in.
Can I use it on my phone? Yes. It runs in your browser on phones and desktops.
Test your regex now
Try the free Regex Tester or browse all the developer tools on PDFFlowState.