Discover 50+ essential regex patterns for developers. Use this cheat sheet with a Regex Tester to build faster and smarter.
Turn concepts into action with our free developer tools. Validate payloads, encode values, and test workflows directly in your browser.
Sumit
Full Stack MERN Developer
Building developer tools and SaaS products
Sumit is a Full Stack MERN Developer focused on building reliable developer tools and SaaS products. He designs practical features, writes maintainable code, and prioritizes performance, security, and clear user experience for everyday development workflows.
If you’re a developer, chances are you’ve searched for "regex example" more times than you can count.
That’s because regex is not about memorizing — it’s about having the right patterns ready when you need them.
This guide is your ultimate regex cheat sheet, packed with 50+ practical patterns you can use in real projects.
And the best way to learn and test them?
👉 Use this tool: https://www.mydevtoolhub.com/tools/regex-tester
Regex syntax can be hard to remember.
Instead of memorizing everything, developers rely on:
This cheat sheet gives you exactly that.
.
\d
\w
\s
\D
\W
*
+
?
{3}
{2,5}
^
$
\b
^[^\s@]+@[^\s@]+\.[^\s@]+$
https?:\/\/[^\s]+
^[6-9]\d{9}$
^[1-9][0-9]{5}$
^[a-zA-Z0-9_]{3,16}$
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
https?:\/\/(www\.)?[^\s]+
#\w+
\d+
(?=abc)
(?!abc)
(abc)
(?:abc)
g → Globali → Case insensitivem → MultilineExample:
/hello/gi
const regex = /\d+/g;
const result = "Order 123 confirmed".match(regex);
console.log(result);
db.orders.find({
orderId: { $regex: "\\d+" }
})
👉 Practice here: https://www.mydevtoolhub.com/tools/regex-tester
.
✔ Should be:
\.
.*
Always test different inputs.
No, use cheat sheets like this.
Use a Regex Tester tool.
Yes, using $regex queries.
No, use parsers for complex data.
Practice regularly with real examples.
Regex becomes easy when you stop memorizing and start using patterns.
This cheat sheet gives you a strong starting point.
But real learning happens when you test and experiment.
👉 Start testing patterns now: https://www.mydevtoolhub.com/tools/regex-tester
With consistent practice, you’ll go from copying regex to writing your own with confidence.
Struggling with messy spreadsheet data? Learn how to enforce clean, validated inputs using Google Sheet Form Generator.
Streamline HR operations using Google Sheets and automated forms. Simplify hiring, onboarding, and employee workflows without coding.
Compare Google Sheet Form Generator vs Google Forms. Discover which tool is better for developers, automation, and scalable workflows.