DevPlainly

Regex Tester & Explainer

Type a pattern and some text: matches are highlighted as you type, capture groups are listed, and every part of the pattern is explained in plain English. Everything runs in your browser.

//gm

3 matches

2026-10-28T09:15:02Z WARN payment-service timeout after 30s
2026-10-28T09:15:07Z INFO auth-service login ok
2026-10-28T09:16:44Z ERROR payment-service card declined

Capture groups

#Matchlevelservice
1WARN payment-serviceWARNpayment-service
2INFO auth-serviceINFOauth-service
3ERROR payment-serviceERRORpayment-service

Explanation

  • (?<level> start of capturing group 1, named "level"
  • INFO the text "INFO"
  • | OR: match either the part before or the part after
  • WARN the text "WARN"
  • | OR: match either the part before or the part after
  • ERROR the text "ERROR"
  • ) end of group
  • the character " "
  • (?<service> start of capturing group 2, named "service"
  • [\w-] one character: a word character (letter, digit or underscore) or "-"
  • + repeat the previous item 1 or more times
  • ) end of group

How to use the regex tester

  1. Enter your pattern without the surrounding slashes, for example \d{4}-\d{2}.
  2. Toggle flags: i ignores case, m makes ^ and $ match at each line, s lets . match newlines, u enables full Unicode.
  3. Paste the text you want to search. All matches are found (the g flag is always on).
  4. Read the explanation to check that each part means what you intended.

Which regex flavor does this use?

The tester uses your browser's JavaScript regex engine, so results match what you get in JavaScript and TypeScript. Python, Java, Go and PCRE share the core syntax but differ in details such as lookbehind support and named-group syntax — Python, for example, also accepts (?P<name>...).

Tips

  • Anchor validation patterns with ^ and $ so they match the whole string.
  • Escape literal dots: example\.com.
  • Prefer specific classes like [^"]* over .* to avoid matching too much.

Need ready-made patterns? See our Regex Cheat Sheet with real examples.