Regex generator
Get ready-made regular expressions for email, phone numbers, dates, URLs, strong passwords and more, then copy code for JavaScript, Python, PHP, Go, Java or C#.
How to generate a regex
- Pick the pattern you need, for example Email or Phone number.
- Adjust the options: match the whole text or find inside it, date format, length…
- Choose your programming language, copy the regex or the sample code and try it on your own data.
Frequently asked questions
No. A regex only checks the shape (day 1–31, month 1–12, a 4-digit year); it does not know how many days February has. To be sure a date is real, check it in code after it matches.
JavaScript, Python, PHP, Go, Java and C#. Each writes slashes, quotes and flags differently, so the tool writes the regex correctly for each one, with sample code.
Go's regex has no "lookahead", which the password pattern needs to check for upper case, lower case, digits and symbols together. In Go, check each rule in code instead.
It accepts the usual addresses and rejects common mistakes (no @, two dots in a row, no domain). Unusual but valid addresses may be rejected; a confirmation email is still the surest check.
It is completely free and needs no sign-up.
Related tools
Regex testerTest a regex: highlighted matches, groups and replaceRegex explainerUnderstand every part of a regexCron expression generatorPick a schedule, get the cron expressionCron expression parserRead a cron expression and see when it runsJWT decoderRead a JWT's header, payload, expiry and check its signatureJWT generatorSign a JWT with a secret or a private keyMarkdown previewType Markdown, preview it live and get the HTMLHTML to MarkdownTurn HTML or copied content into MarkdownUnix timestamp converterTimestamp ⇄ date, with the current epoch time