Skip to content
Choice → RegexDeveloper tools

Regex Generator

Ready regular expressions for emails, phones, dates, PAN, GSTIN and more: test them, and copy code for five languages.

Did this tool work for you?

About this tool

About Regex Generator

Regex Generator gives you tested regular expressions for common jobs, so you do not have to write them yourself. Search or pick from 30 patterns: email addresses, web addresses and domains, Indian and international phone numbers, dates and times, whole and decimal numbers, amounts with Indian commas, percentages, colors, slugs, usernames, passwords with rules, UUIDs, hashtags, and Indian codes such as PAN, GSTIN, IFSC, PIN code and vehicle numbers. Each pattern comes with a short note, examples that match and examples that do not. Choose how you want to use it. Check a whole value adds the signs for start and end, which is right for a form field. Find in a text leaves them out and makes sure the match is not part of a longer word or number, which is right for searching a document. Then try your own values: one per line with a tick or a cross, or a text in which matches are highlighted. The code below is ready for JavaScript, HTML forms, Python, PHP and Java, with backslashes and quotes written as each language needs them. HTML forms deserve a note: browsers now read the pattern attribute in a stricter way and silently ignore a pattern they do not like, so the version for forms is adapted. Patterns for letters of any language use Unicode and match Hindi as well as accents; they need the u flag, or the regex package in Python, and the code includes it. All patterns were run against their examples in JavaScript, Python and PHP. Remember what a pattern can do: it checks the shape of a value. 2026-02-31 has the shape of a date, and an email address with the right shape may not exist. For important data, check the value as well, and always on the server too.

Regex Generator tool

What to use regular expressions for

Check, find and clean

Forms

Check a field before sending.

ExampleA PIN code has six digits and no leading zero.

Finding

Collect addresses from a text.

ExampleAll emails in a long page.

Hiding data

Find card or phone numbers.

ExampleReplace them before sharing a log.

Checking imports

Look for rows with a bad code.

ExampleGSTIN in a customer list.

Scripts

Use the same pattern in two languages.

ExampleJavaScript in the page, PHP on the server.

Learning

See how a pattern is built.

ExampleCompare the two dates.

Regex tips

Patterns that behave

Do not be too strict

Names and addresses vary more than you think.

Check on the server

A check in the browser can be skipped.

Shape is not truth

Check dates and check digits in code.

Try it on your data

Test and explain any pattern.

Open Regex Tester

Replace matches

Use a pattern to change text.

Open Find and Replace

Only emails?

Collect them from a text.

Open Email Extractor
Built & tested by

HemantInsights

Senior Software Engineer · Developer of Toolyconvert

Hemant developed Regex Generator and tests it on desktop and mobile with real files. He is a senior software engineer from Dehradun, India, building websites since 2014, and designed and developed Toolyconvert end to end.

Last updated 25 November 2026

Answers and guidanceFrequently Asked Questions
What is a regular expression?
A short description of a text pattern, such as six digits or an email address, that programs use to check and find text.
Which email regex should I use?
The one here fits common addresses. Only a confirmation message proves that an address exists.
What is the difference between the two uses?
Check a whole value accepts nothing before or after. Find in a text looks for matches inside longer text.
Does it work in Python and PHP?
Yes. The code is written for each language and was run there. Java code is written but was not run.
Why does my pattern not work in an HTML form?
Browsers ignore patterns that are not valid in their strict mode. Use the code from the HTML form tab.
Can it check if a GSTIN is real?
No. It checks the shape. The last character is a check digit and the number must be registered.
Are my test values sent anywhere?
No. They stay in your browser.
More tools for your workflowRelated Tools

Featured on

Toolyconvert is listed on these product directories and launch platforms.