Coding / Chiefletter Workbench
Regular expression tester
Check a regular expression against sample text.
Run a JavaScript regular expression against sample text and inspect matches with their character positions. The tester adds global matching so it can report each occurrence. Syntax errors appear in the result panel.
Use it here
Regular expression tester
Runs in your browser. Your input is not sent to Chiefletter.
How to use this tool
- Enter the pattern without slash delimiters, such as `\bcat\b`.
- Choose flags for case sensitivity or multiline matching.
- Paste a representative sample and test the expression. Include edge cases before using a pattern in production.
Use cases
- Check a validation pattern against expected and rejected examples.
- Find repeated values in a local text sample.
- Explain a regular expression to a teammate with visible match positions.
Notes and limits
A regular expression that matches sample text is not proof that it covers every valid input. Test empty input, punctuation, Unicode, and long strings relevant to your application.
Frequently asked questions
Which regex engine does this use?
The browser JavaScript RegExp engine. Other languages have different syntax and features.
Why does it add the global flag?
Global matching lets the page list all matches instead of returning only the first one.
Can a regex cause a browser freeze?
Some patterns backtrack heavily on certain inputs. Use short samples and avoid testing untrusted patterns on large text.