Regex Tester Online

Test regular expressions against any text in real-time. View all matches, capture groups, and positions. JavaScript regex syntax.

/ /

Regex Quick Reference

.Any character except newline
\dDigit [0-9]
\wWord char [a-zA-Z0-9_]
\sWhitespace
^Start of string/line
$End of string/line
*0 or more
+1 or more
?0 or 1 (optional)
{n,m}Between n and m times
(abc)Capture group
[abc]Character class
(?:abc)Non-capturing group
a|bAlternation (a or b)

API Example

## Test regex with curl
curl -X POST https://apitoolkit.pro/api/v1/regex \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pattern":"(\\w+)@(\\w+)\\.\\w+","flags":"gi","input":"hello@example.com"}'

## JavaScript
const res = await fetch('https://apitoolkit.pro/api/v1/regex', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({ pattern: '\\d+', flags: 'g', input: 'abc 123 def 456' })
});
const { matches, count } = await res.json();

Get API Key — $5/mo →

Other Free Developer Tools