PRPickrack

Regex Tester

Test regex live with match highlighting and capture groups. JavaScript RegExp.

//g
Hover for flag meaning
Presets:
Email me at [email protected] or [email protected] for help.

Capture groups by match

Match 1 at offset 12

[email protected]

Match 2 at offset 34

[email protected]

Test regular expressions live with match highlighting, capture groups, and JavaScript flags.

Regex Tester is essential for any developer who writes regular expressions — for input validation, log parsing, search-and-replace, or scraping. Iteration speed matters: change the pattern, see matches highlight live, fix edge cases without redeploying.

Pickrack's regex tester uses native JavaScript RegExp. Type a pattern + flags, paste sample text, see matches highlighted in real-time with capture groups labeled. Supports all JS regex flags: g (global), i (case-insensitive), m (multiline), s (dotall), u (Unicode), y (sticky).

Free, no signup. Note: JavaScript regex differs from PCRE (Perl/PHP) and Python re — lookbehind, named groups, atomic groups have varying support. Pickrack reflects pure JS regex behavior (use this for browser/Node.js code).

Key features

  • Live highlightingMatches highlighted as you type. Capture groups labeled with index or name (for named captures (?<name>...)).
  • All JS flags supportedg i m s u y — toggle each. Tooltip explains what each flag does.
  • Match count + indexTotal match count shown. Each match displayed with its starting offset.
  • Capture groups breakdownFor each match, see all capture groups with their values. Named groups labeled.
  • Common pattern libraryQuick-load presets: email, URL, IPv4, IPv6, phone, date — to start from a known-working pattern.

How to use

  1. Step 1: Enter your regex patternType the pattern (without leading/trailing slashes) and toggle flags.
  2. Step 2: Paste test textMulti-line input supported. Matches highlight as you type.
  3. Step 3: IterateAdjust pattern/flags. Use the capture groups output to refine extractions.

When to use

  • Validate email format with anchored pattern + edge cases
  • Extract URLs from a block of text using non-greedy matchers
  • Parse log lines to pull out timestamps, error codes, status messages
  • Replace placeholders in templates ({{name}} → John) — preview first
  • Validate phone numbers in a specific country format
  • Find duplicate words with backreferences (\b(\w+)\b.*\b\1\b)

Frequently asked questions

Why does my pattern from Stack Overflow not work?

Stack Overflow answers often use PCRE (Perl/PHP) or Python regex. JavaScript regex has limitations: no atomic groups, no possessive quantifiers, limited lookbehind support pre-Safari 16. Test on Pickrack to confirm JS compatibility.

Does this support lookbehind?

Yes — modern JavaScript (ES2018+) supports (?<=...) positive and (?<!...) negative lookbehind. Older browsers may not. Pickrack runs in your browser, so Chrome/Firefox/Safari recent versions all support it.

What about named capture groups?

Yes. (?<year>\d{4}) works in modern JS. Output shows the group by name.

Why is my regex matching fewer/more than expected?

Common gotchas: g flag needed for all-matches (default returns first match only). Anchors ^ and $ only work as expected with m (multiline) flag. . doesn't match newlines without s (dotall) flag.

Can I test PCRE / Python / Go regex here?

No — Pickrack uses JavaScript RegExp. For PCRE, try regex101.com (separate dropdown for flavor). For Go, RE2 has fewer features (no backreferences, no lookbehind). Pickrack reflects JS behavior only.

Is there a regex security risk to be aware of?

Yes — ReDoS (Regular Expression Denial of Service). Pathological patterns (e.g., (a+)+) can hang the engine on adversarial input. Pickrack runs your regex in YOUR browser, so a bad regex only freezes your tab. For production, validate regex performance with safe-regex npm or use RE2 engines.

What flags should I use most?

g for global match (most common). i for case-insensitive. m for line-by-line anchoring. s if your pattern needs . to match newlines. u for proper Unicode (essential for emoji/non-Latin scripts).

Does it support multiline regex with comments?

JavaScript doesn't have a x (extended/verbose) flag. For complex patterns, build them as a string with comments and pass to new RegExp(pattern, flags) in your code. Pickrack tests the final compiled pattern.

Related tools