{"copy":{"explain":"The tool builds a JavaScript regular expression from your pattern and flags, and runs it over the test text to find every match, the same way String.matchAll does in a browser or Node.js. Each match is marked in the text, and the table lists where it starts and what each group captured. The pattern is also read piece by piece to explain it in plain English. Replace uses the same rules as String.replace, so $1 and $2 put the groups back (and named groups by their name). The search runs in a background worker and stops after 2 seconds, so a pattern that never ends cannot freeze the page.","example":"Pattern [6-9]\\d{9} with flag g on &quot;Call 9876543210 or 8123456789&quot; → 2 matches: 9876543210 at position 5 and 8123456789 at position 19. Pattern (\\d{2})/(\\d{2})/(\\d{4}) with replace $3-$2-$1 turns 26/01/2026 into 2026-01-26.","intro":"Test a regular expression on your own text: every match is marked as you type, with groups, a plain-English explanation and find-and-replace.","sections":[["What is a regular expression?","A regular expression (regex) is a small pattern that describes text. \\d means a digit, + means one or more, [A-Z] means a capital letter, ^ and $ mean the start and end. So ^[6-9]\\d{9}$ means a 10-digit number starting with 6, 7, 8 or 9: an Indian mobile number. Regex is used in form validation, search and replace in code editors, Excel and Google Sheets (REGEXMATCH), log searching, and data cleaning in Python and JavaScript."],["How to use the tester","Type a pattern in the box between the slashes, or tap a ready pattern like Email, Indian mobile or PAN. Paste your text below. Matches are marked as you type, and the count shows at the top. Open Matches and groups to see each match and what every bracket captured. Open What the pattern means for an explanation, and Find and replace to try a replacement with $1 for the first group."],["The flags","g finds all matches instead of only the first. i ignores upper and lower case. m makes ^ and $ match at the start and end of every line, not only of the whole text. s lets the dot match new lines too. u turns on full Unicode, needed for emoji and for \\p{…} classes like \\p{L} for any letter in any language, including Hindi and Telugu."],["Patterns that freeze","Some patterns, like (a+)+$ or (.*)*x, can take billions of steps on text that almost matches. This is called catastrophic backtracking, and in a real app it can slow down or crash a server. The tester runs your pattern in the background and stops it after 2 seconds, then tells you. Fix it by removing nested repeats, making groups more specific, or using possessive-style rewrites."],["A small cheat sheet","\\d digit, \\w letter or digit or _, \\s space, . any character, [abc] one of a, b or c, [^abc] anything but those, ^ start, $ end, * 0 or more, + 1 or more, ? optional, {3} exactly 3, {2,5} 2 to 5, ( ) group, | or, \\b word boundary. Add ? after *, + or {…} to match as little as possible."],["Ready patterns for India","Mobile: ^[6-9]\\d{9}$. PIN code: ^[1-9]\\d{5}$. PAN: ^[A-Z]{5}\\d{4}[A-Z]$. GSTIN: ^\\d{2}[A-Z]{5}\\d{4}[A-Z][1-9A-Z]Z[0-9A-Z]$. IFSC: ^[A-Z]{4}0[A-Z0-9]{6}$. Vehicle number (most states): ^[A-Z]{2}\\d{1,2}[A-Z]{1,3}\\d{4}$. Aadhaar (format only): ^[2-9]\\d{11}$."]],"faqs":[{"q":"Which regex flavour does this use?","a":"JavaScript (ECMAScript), the same as Chrome, Node.js, TypeScript and most web forms. Most simple patterns work the same in Python, Java, PHP, C# and Go. Differences are mostly in look-behind support, named group syntax (Python also accepts (?P&lt;name&gt;…)), and Unicode classes."},{"q":"How do I match a full stop or a bracket?","a":"Put a backslash before it: \\. matches a full stop, \\( a bracket, \\? a question mark and \\\\ a backslash. Without the backslash, . means any character, which is a common cause of patterns matching too much."},{"q":"What is the regex for an Indian mobile number?","a":"^[6-9]\\d{9}$ checks a plain 10-digit number. To allow +91 or 0 in front and a space or dash, use ^(?:\\+91[\\s-]?|0)?[6-9]\\d{9}$. Remove the ^ and $ to find numbers inside longer text, and add the g flag to find all of them."},{"q":"Why does my pattern match only the first result?","a":"Turn on the g (global) flag. Without it, a JavaScript regex stops after the first match. In code, use text.match(/…/g) or text.matchAll(/…/g) to get every match, and text.replace(/…/g, …) to replace all of them."},{"q":"Is what I paste sent anywhere?","a":"No. Your pattern and text stay on your device. Everything runs in your browser on your own phone or computer, and nothing is sent to our servers or saved."},{"q":"Is the Regex Tester free?","a":"Yes. There is no sign-up, no limit and nothing to install. It also works offline once the page has loaded."}]},"feat":[["Live highlights","Every match marked as you type."],["Explained","The pattern in plain English."],["Safe","Stops patterns that would freeze the page."]],"faqx":[{"q":"What is the regex for an email address?","a":"A practical one is [\\w.+-]+@[\\w-]+(\\.[\\w-]+)+ with the i flag. No simple pattern matches every valid email exactly; for sign-up forms, check for one @ and a dot after it, then send a confirmation email."},{"q":"What is the regex for a PAN number?","a":"^[A-Z]{5}[0-9]{4}[A-Z]$: five capital letters, four digits and one capital letter, like ABCPR1234K. The fourth letter shows the type of holder: P for a person, C for a company, H for a HUF and F for a firm."},{"q":"What do the brackets ( ) do?","a":"They make a group: the text matched inside is captured, so you can use it in a replacement as $1, $2 and so on. Use (?: … ) for a group that is not captured, and (?&lt;name&gt; … ) to give the group a name."},{"q":"Can I test a regex for Excel or Google Sheets?","a":"Google Sheets REGEXMATCH, REGEXEXTRACT and REGEXREPLACE use a very similar syntax (RE2), so most patterns tested here work there. RE2 does not support look-ahead, look-behind or back-references like \\1. Excel 365 also has REGEXTEST, REGEXEXTRACT and REGEXREPLACE."}]}