Test JavaScript regex patterns and capture groups
Enter a regular expression and a test string; all matches are highlighted in real time, with capture groups listed for each match. Common flags are supported — i (case-insensitive), g (global), m (multiline). Feedback is instant, shrinking the write-a-regex loop from minutes to seconds.
Regex for logs, validation and text extraction
Extracting IPs, timestamps, or error codes from logs; validating form input (emails, phone numbers, URLs); batch renaming or replacing patterned text; pulling fields out of HTML or config files. Get the expression right here first, then paste it back into code — far faster than trial-and-error in a running program.
Regex flags, greedy matches and backtracking
Greediness is the number-one trap: .* consumes as much as possible, often swallowing whole sections; most of the time you want the lazy .*?. Next is catastrophic backtracking: nested quantifiers like (a+)+ degrade exponentially on certain inputs (ReDoS) — dangerous in production services. Finally, dialects differ: this tool follows JavaScript syntax, which behaves differently from Java, Python, or PCRE — some Unicode features require the u flag, for example.
Will this regex behave the same in Python, Java or PCRE?
Not always. This tester uses JavaScript regex syntax. Flags, Unicode handling and supported constructs differ between engines. Check the expression in the actual language and version that will run it; a match here does not prove compatibility elsewhere.