Regex Tester — Test JavaScript Regular Expressions
- This tool runs entirely in your browser. Nothing you enter or upload is sent to a server.
Regular expression
Test string
2 matches
Contact Asha at asha.verma@example.com or +91 98765 43210. Invoices: 2025-04-12, 2025-11-03. Office PIN 411001. Backup mail: support@utildojo.com
Replace
About this tool
Type a pattern and see every match highlighted in your test text immediately. Toggle flags — global, ignore case, multiline, dotAll and unicode — and the results update as you go. The tester opens with an email pattern and a sample paragraph so you can see how it behaves.
The capture groups table lists each match with its numbered and named groups, and the replace box previews the result of String.replace with $1 or $<name> references. For example, the built-in date pattern (?<year>\d{4})-(?<month>0[1-9]|1[0-2])-(?<day>0[1-9]|[12]\d|3[01]) finds 2025-04-12 and 2025-11-03 in the sample, and the replacement $<day>/$<month>/$<year> turns the first into 12/04/2025.
The common patterns menu includes ready-made expressions for emails, URLs, Indian mobile numbers, PAN, PIN codes, IPv4 addresses, dates, hex colours, whole numbers and a strong-password check. Treat them as starting points. The Indian mobile pattern, for instance, wants ten digits in a row starting with 6 to 9, so a number typed as 98765 43210 with a space is not matched; and the email pattern is deliberately loose, so it accepts some addresses that are not strictly valid.
When a pattern is invalid, the message from the browser appears above the text, for example “Unterminated group” for an unclosed bracket. Results are capped at 1,000 matches, and the group table shows the first 200. Because the engine is your browser’s own, a pattern that backtracks badly on long text can make the page slow, so try it on a short sample first. The test text is processed locally and never uploaded.
Frequently asked questions
Which regex flavour does this use?
Your browser’s JavaScript (ECMAScript) engine, the same one used by Node.js and front-end code. Some PCRE features like possessive quantifiers are not available.
Why does only one match show?
Without the g (global) flag a regex stops after the first match. Tick “global” to find them all.
How do I reference a named group in a replacement?
Use $<name>, for example $<year> for a group written as (?<year>\d{4}).
What do the m and s flags do?
Multiline makes ^ and $ match at the start and end of each line, not only of the whole text. Dot matches newline lets . match line breaks, which it normally does not.
Why does my pattern work in Python or PHP but not here?
Those use different regex flavours. JavaScript lacks some features, such as possessive quantifiers and a (?i) flag at the start of a pattern, so use the flag boxes instead.