>Fafa Dev Tools

Regex Tester

Test regular expressions online with real-time matching and group extraction. Free regex tester with flags support.

0 chars
Output will appear here...

What is Regex Tester?

A regular expression (regex) is a pattern-matching language used to search, validate, and extract text. Common uses include form validation (email, phone), log parsing, search-and-replace operations, and data extraction. Regex uses special characters like \d (digit), \w (word), . (any), * (zero or more), + (one or more) to define patterns.

How to Use

  1. Enter your regex pattern in the Pattern field (e.g., \d+ to match numbers)
  2. Set flags: g (global), i (case-insensitive), m (multiline) as needed
  3. Type or paste the test text in the input area below
  4. Matches appear in real-time with index positions and captured groups
  5. Click Test to force a re-evaluation, or just keep typing for live updates

Examples

Match email addresses

InputPattern: \b[\w.-]+@[\w.-]+\.\w{2,}\b
OutputMatches: hello@example.com, support@test.org

Extract numbers from text

InputPattern: \d+ | Text: "Order #1234 has 5 items"
OutputMatches: [1] "1234" at index 7, [2] "5" at index 19

Frequently Asked Questions

What regex flags should I use?

g = global (find all matches, not just the first). i = case-insensitive. m = multiline (^ and $ match per line). s = dot matches newlines. For most validation tasks, start without flags and add them as needed.

Why does my regex show 'No matches'?

Check that your pattern doesn't have unescaped special characters. Use \ to escape characters like . * + ? ( ) [ ] { } \ ^ $. Also verify your flags — the g flag is needed to find all matches.

What's the difference between greedy and lazy matching?

Greedy (*, +) matches as much as possible. Lazy (*?, +?) matches as little as possible. For example, <.*> on '<a><b>' matches the whole string (greedy), while <.*?> matches '<a>' then '<b>' separately (lazy).