Test a regular expression pattern against sample text and see matches update live as you type.
Google AdSense Banner
This area will contain advertisements after approval.
Google AdSense Banner
This area will contain advertisements after approval.
Enter a regular expression pattern (without the surrounding slashes), specify flags like 'g' for global matching or 'i' for case-insensitive matching, then paste your test text. Matches update live and show the matched text along with its position in the string.
'g' (global) finds all matches instead of stopping at the first one. 'i' (case-insensitive) ignores letter case. 'm' (multiline) changes how ^ and $ behave across multiple lines. Flags can be combined, for example 'gi' for global, case-insensitive matching.
Using the pattern \d{3}-\d{4} with the 'g' flag against the text 'Call 555-1234 or 555-5678' matches both '555-1234' and '555-5678', since \d{3} matches exactly three digits, the literal hyphen matches itself, and \d{4} matches exactly four digits. Without the 'g' flag, only the first match, '555-1234', would be reported, matching stops at the first occurrence.
Forgetting the 'g' flag when expecting all matches in the text, without it, JavaScript regex stops after the first match instead of finding every occurrence.
Not escaping special characters that should be matched literally, a period (.) matches any character unless escaped as \., and a literal parenthesis or dollar sign needs \( or \$ if you mean the character itself rather than its regex meaning.
Assuming regex is 'greedy' matching is always what you want, a pattern like <.+> against '<b>bold</b>' matches the entire string from the first < to the last >, not just '<b>', use <.+?> (non-greedy) if you want the shortest possible match instead.
This uses standard JavaScript regular expression syntax, which is very similar to PCRE (used in many other languages) but with some differences in advanced features.
No, all pattern matching happens directly in your browser using JavaScript's built-in regex engine, your text is never transmitted anywhere.
Google AdSense Banner
This area will contain advertisements after approval.