AdSense Placeholder
Slot: header_tool

Regex Tester

Test and debug JavaScript regular expressions in real time

/ / g
Matches will be highlighted here as you type.
Matches
0
Groups
0
# Match Group 1 Group 2 Group 3+
No matches yet

AdSense Placeholder
Slot: tool_mid_article

Live Highlighting

See every match highlighted directly inside your test string as you type, no need to hit a "run" button.

Capturing Groups

Break down each match into its numbered capturing groups in a clean table, ideal for debugging extraction patterns.

Replacement Preview

Use $1, $2, etc. in the replacement field to preview String.replace() output live.

Private By Design

Every match runs in your browser using JavaScript's native RegExp engine. Your patterns and test data never leave your device.

Getting the Most Out of Regular Expressions

Regular expressions are a compact language for describing patterns in text. They power form validation, log parsing, search-and-replace, and countless other developer tasks, but a single misplaced character can change what a pattern matches entirely. This Regex Tester lets you iterate on a pattern against real sample data and see the effect of every keystroke immediately, including which flags are active and how capturing groups are populated.

Try a classic email pattern like ([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,}) or a basic URL matcher like (https?):\/\/([^\/\s]+)(\/[^\s]*)? to see the group breakdown table populate with the pieces each pattern extracts.

Key Takeaways

  • Flags matter: The g flag finds every match instead of stopping at the first one; i ignores case; m changes how ^/$ behave across lines; s lets . match newlines.
  • Groups are numbered by opening parenthesis: the first (...) in your pattern is Group 1, the second is Group 2, and so on.
  • Test edge cases: empty strings, repeated matches, and unusual whitespace often reveal bugs a single happy-path test misses.
  • Privacy: All matching and highlighting happens locally in your browser using the native RegExp object; nothing you type here is ever sent to our servers.
AdSense Placeholder
Slot: footer_leaderboard