The Regular Expression (RegEx) Cheat Sheet you always wanted
I get it even though Regex is incredibly useful, it is extremely hard to master! This is a cheat sheet that provides the most common RegEx use cases that will help you whenever need a sneak peek at the Regex syntax!
NOTE: Medium doesn’t support a native tables, so the tables below are screenshots. If you want it in tabular format, check out my blog on Dev
By default quantifiers are greedy (they try to match as much of the string as possible). The
? character after the quantifier makes the quantifier non-greedy (it will stop as soon as it finds a match).
\d+? for a test string
12345 will match only
\d+ will match the entire string
Flags are put at the end of the regular expression. They are used to modify how the regular expression behaves.
/a/ for a test string
a will match
a only, but adding the flag
/a/i) would match both
That’s all folks!
Research says, writing down your goals on pen & paper makes you 21% to 39% more likely to achieve them. Check out these notebooks and journals to make the journey of achieving your dreams easier: https://www.amazon.com/Tapajyoti-Bose/e/B09VGDDHRR
Follow me for weekly new tidbits on the domain of tech!
Need a Top Rated Front-End Development Freelancer to chop away your development woes? Contact me on Upwork
Want to connect? Reach out to me on LinkedIn
I have moved to Bali, Indonesia as a Digital Nomad. Follow me on Instagram to check out what I am up to.