DevHive

Regex Tester

Test and debug regular expressions

//
Hello World! Testing regex 123 with DevHive.
6 matches
#MatchIndex
1Hello0
2World6
3Testing13
4regex21
5with31
6DevHive36
[Hello] [World]! [Testing] [regex] 123 [with] [DevHive].

How to Use Regex Tester

  1. 1

    Enter your regular expression in the pattern field.

  2. 2

    Paste the text you want to test in the input area below.

  3. 3

    Matches are highlighted in real time as you type.

  4. 4

    Check the match list for a summary of all matches found.

About Regex Tester

Test regular expressions online with real-time matching, groups, and replacement. Supports JavaScript regex.

Best Use Cases

  • Validating an email format pattern before deploying a form
  • Extracting phone numbers from a large block of text
  • Testing a URL matching pattern for a web server route config
  • Debugging a regex that captures too many or too few matches
  • Building a search-and-replace pattern for log file parsing

Examples

Email validation

Enter ^[\w.-]+@[\w.-]+\.[a-z]{2,}$ as the pattern and paste sample emails to check matches.

Extract dates

Use \d{4}-\d{2}-\d{2} to highlight all YYYY-MM-DD dates in your text.

Replace whitespace

Pattern \s+ with replacement single space to collapse multiple spaces into one.

Common Mistakes to Avoid

  • !Forgetting to escape special characters like dots, which match any character
  • !Using greedy quantifiers (.*) when lazy (.*?) is needed
  • !Not enabling the global flag when you need all matches

Limitations

  • Only supports JavaScript regex syntax and flags
  • Cannot test lookbehind in older browsers that lack support
  • Does not support PCRE-only features like recursive patterns

Frequently Asked Questions

What flags does this regex tester support?

Supports g (global), i (case insensitive), m (multiline), s (dotAll), and u (unicode) flags.