Quick Tools Online

Free Regex Tester Online

Test regular expressions against sample text and see matches highlighted in real time. Supports JavaScript regex syntax with global, case-insensitive, multiline, and dotAll flags.

Regular expressions are a compact language for describing text patterns — they let you match, extract, and validate strings in ways that simple string comparisons cannot. A regex can find all email addresses in a block of text, validate that a phone number fits a specific format, or replace every occurrence of a pattern at once. The challenge is that regex syntax is dense and a small mistake produces wrong or no matches. This tester lets you write a JavaScript regex pattern, set flags, and immediately see which parts of a test string match, updated live as you type.

Ad Space

Regex Tester

Flags

Ad Space

How to use this regex tester

  1. Enter your regex pattern in the Pattern field. Do not include the leading and trailing slashes — just the pattern itself.
  2. Check the flags you want: g (global), i (case-insensitive), m (multiline), s (dotAll).
  3. Type or paste your test string in the Test String box.
  4. Matches are listed below with their position and any captured groups.

Common use cases

  • Validating that a user-entered email, phone number, or postal code matches an expected format
  • Extracting all URLs, dates, or IP addresses from a block of unstructured text
  • Writing a search-and-replace pattern for a code editor before applying it
  • Debugging a regex from a codebase that is not matching what it should
  • Learning regex syntax by seeing live feedback on how each token affects what is matched

Frequently asked questions

What regex flavor does this use?

JavaScript's built-in RegExp. The syntax supports character classes, quantifiers, anchors, groups, and lookaheads. It does not support some Perl or PCRE features like variable-width lookbehinds in older environments.

What is the 'g' flag and when do I need it?

The global flag (g) makes the regex find all matches instead of stopping at the first one. Use g when you want to highlight, count, or process every occurrence of a pattern in the text.

Why does my pattern work here but fail in my code?

Common causes: different flags in the code; backslashes need doubling in strings (new RegExp("\\d+")) vs. regex literals (/\d+/); different methods like match() vs. exec() behave slightly differently.

How do I match a literal dot or parenthesis?

Special regex characters must be escaped with a backslash. To match a literal dot, write \. To match a literal parenthesis, write \( and \). Without the backslash, . matches any character and ( starts a group.

Ad Space

More Tools