ProductCompareToolsPricingBlog
Sign inCreate an account
  1. Tools

Regex Tester

Type a pattern and some test text. Every match is highlighted as you type and listed with its index and capture groups. It uses the JavaScript RegExp engine in your browser.

//gi
Matches (2)
Email me at hello@specway.com or support@example.org.
Not an email: alice@.com or @broken.io.
  1. 1. hello@specway.com @ 12
    groups: [1] hello, [2] specway.com
  2. 2. support@example.org @ 33
    groups: [1] support, [2] example.org

How it runs

The pattern is compiled with new RegExp(pattern, flags) and walked with .exec(). The g flag is always on so every match is found. Toggle i, m, s and u as needed.

Matching stops after 1,000 matches so a pattern that matches everywhere does not freeze the page. Write the pattern as you would between slashes: no string-literal escaping.

Patterns you will want again

Paste one into the pattern field above and try it on your own text.

patterns
email (loose) \b[\w.+-]+@[\w-]+\.[\w.-]+\b
url https?://[\w./?=&%~+:#-]+
uuid v4 [0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}
iso date \d{4}-\d{2}-\d{2}
hex color #[0-9a-fA-F]{3,8}

When not to use a regex

For anything nested: HTML, JSON, code. A regex cannot count matching brackets or tell a real tag from one inside a comment. Use a parser (DOMParser, JSON.parse). Regexes are for flat text: IDs, log lines, prefixes.

Testing a pattern from an API schema?

Specway reads the schemas in your OpenAPI file and shows each field's type and rules on the endpoint page. Free for one API: create an account.

A page per endpoint
Parameters, request body and responses read from the spec, grouped by tag in the sidebar.
Playground
Fill in the parameters and send a real request from the docs page.
Code samples
cURL, Node, Python, Ruby and PHP for every endpoint, with a copy button and Open in Postman.

Questions

How do I test a regex online?+

Type the pattern, pick flags, and paste the test text. Matches are highlighted in the text and listed with their index and capture groups. It all runs in your browser.

What's the difference between JavaScript regex and PCRE?+

Most syntax is the same. JavaScript has no possessive quantifiers, atomic groups, recursion or conditionals, which PCRE has. If the pattern is for PHP, Perl or another PCRE engine and uses those, test it there too.

What do the regex flags mean?+

g finds every match instead of the first (always on here). i ignores case. m makes ^ and $ match at each line. s lets . match line breaks. u turns on Unicode mode, needed for \u{...} escapes and characters outside the basic plane.

Why is my regex slow / hanging?+

Usually catastrophic backtracking: nested quantifiers like (a+)+ that try exponentially many ways to match. Anchor the pattern, make alternatives not overlap, and avoid a quantifier inside a quantified group.

How do I escape special characters in regex?+

Put a backslash before . * + ? ^ $ ( ) [ ] { } | \ and /. In this tester you type the pattern itself, so \. matches a dot. In a JavaScript string you would have to double each backslash.

What's a capture group vs a non-capture group?+

(foo) captures the matched text as a numbered group. (?:foo) groups without capturing. Use non-capturing groups when you need grouping for | or a quantifier but do not need the text.

Why does my regex match unexpected things?+

Usually a missing ^ or $ so it matches anywhere, a . meant as a literal dot, or an unescaped special character. Test with text that should not match, not just text that should.

Related tools

  • JSON FormatterPretty-print or minify.
  • cURL to CodeA curl command as JS, Python or Go.
  • JWT DecoderRead a token's header and payload.
  • JSON ValidatorSyntax errors with line and column.

See your docs in a minute

Paste the link to your OpenAPI file. Free for one API, no card needed.

Get startedSee pricing

API reference docs from your OpenAPI file.

Product

  • How it works
  • Endpoint pages
  • Code samples
  • Spec sync
  • Spec changes
  • API versions
  • Changelog
  • Recipes
  • Docs assistant
  • Your domain and look
  • Insights
  • Private docs
  • Team SSO
  • Pricing

Compare

  • vs ReadMe
  • vs Mintlify
  • vs Redocly
  • vs Scalar
  • vs Swagger UI
  • Postman alternatives
  • All comparisons

Tools

  • OpenAPI validator
  • OpenAPI diff
  • Swagger 2 to OpenAPI 3
  • cURL to code
  • JWT decoder
  • YAML and JSON
  • llms.txt generator
  • All tools

Resources

  • Guides
  • OpenAPI errors
  • Glossary
  • Public APIs directory
  • Blog
  • Help
  • llms.txt
  • llms-full.txt

Company

  • About
  • Contact
  • Privacy
  • Terms

© 2026 Specway. Made in Utah by Modlific LLC.

GitHubXLinkedIn