Regex Tester & Extractor
DeveloperTest regex patterns in real time, highlight matches, inspect capture groups, and generate code snippets.
Regex Workspace
Matches: 2HIGHLIGHT RESULT
product-120 order-42 invalid
CAPTURE GROUPS
| # | Full Match | Groups |
|---|---|---|
| 1 | product-120 | g1: product | g2: 120 |
| 2 | order-42 | g1: order | g2: 42 |
Reference
Regex Cheat Sheet
| Token | Meaning |
|---|---|
| . | Any character except newline |
| \d | Digit (0-9) |
| \w | Word character |
| \s | Whitespace |
| ^ / $ | Start / end of line |
| [abc] | Any character in class |
| [^abc] | Any character not in class |
| ( ... ) | Capture group |
| (?: ... ) | Non-capturing group |
| a|b | Alternation |
| * + ? | Quantifiers |
| {n,m} | Range quantifier |
Code Snippet
const regex = new RegExp('(\\w+)-(\\d+)', 'g');
const text = 'product-120
order-42
invalid';
const matches = [...text.matchAll(regex.global ? regex : new RegExp(regex.source, regex.flags + 'g'))];
console.log(matches);Share
You might also like
- JSON Path FinderInspect JSON, copy exact JSONPath expressions, and test paths locally.
- URL Encoder DecoderEncode and decode URL components locally in your browser.
- Base64 Encoder DecoderEncode and decode Base64 text locally in your browser.
- GUID / UUID GeneratorGenerate UUIDs and convert GUIDs to short GUIDs locally in your browser.
- JSON FormatterFormat, prettify and validate JSON instantly. Switch indent, minify in one click. 100% client-side.
- Cron Job ParserParse full crontab lines with commands into human-readable schedules and preview the next 5 runs locally.
- HTML PreviewerWrite or paste HTML and preview it live in a sandboxed iframe. Supports full pages and fragments. 100% client-side.
- JWT DecoderDecode and inspect JWT tokens. View header, payload claims and expiry status instantly. 100% client-side — token never leaves your browser.
- Unix Timestamp ConverterConvert Unix epoch seconds to datetime and back. 100% client-side.
- Color PickerPick any color and copy HEX, RGB, and HSL values instantly. 100% client-side.