Regex Tester

Featured

Test, debug and learn regular expressions with real-time matching, highlighting and match details.

Developer ToolsFree & Online
Loading tool...

About this tool

A regular expression (regex) is a compact pattern used to search, match, validate and extract text. Instead of writing custom code to check whether a string "looks like" an email, a phone number or a date, you describe the shape of that text once with a regex and let the engine find every match for you.

What is a regular expression?

A regex is a string of special characters and literals that defines a search pattern. For example, the pattern ^\d{4}-\d{2}-\d{2}$ matches text that starts with four digits, a dash, two digits, another dash and two digits — i.e. a date like 2026-07-17.

Why would you use it?

  • Validation — check that user input is a valid email, URL, phone number or password.
  • Search & extraction — find every price, hashtag or link inside a block of text.
  • Cleaning data — remove unwanted characters or normalize formats before importing.
  • Replacing text — swap dates, phone formats or placeholders in one pass.
  • Learning — experiment safely with patterns before using them in your code.

This tester runs entirely in your browser. Type a pattern, paste the text you want to check, and see every match highlighted instantly with its position and capture groups — nothing is sent to a server.

How to use

  1. Enter your pattern in the Regular Expression field (without the surrounding slashes).
  2. Toggle the flags you need: g for all matches, i for case-insensitive, m for multiline.
  3. Pick a ready-made pattern from Common Patterns (email, URL, phone, IPv4, date, hex color, username, password) to start quickly.
  4. Type or paste the text to test in the Test String box.
  5. Read the result: matched text is highlighted in yellow, the number of matches is shown, and each match lists its index and capture groups.
  6. Use the copy button to copy the final /pattern/flags string straight into your code.