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 case...
For further actions, you may consider blocking this person and/or reporting abuse
Most useful image I ever downloaded:
Abeg where you download this
As usual, I feel compelled to point out that you don't need most of these things and you don't want most of these things.
Especially readahead and lookbehind are features that add needless complexity and performance drawbacks (given an ideal implementation of the underlying algorithm).
My rule of thumb is usually: If you can't express it using exclusively concatenation, union, alternation, Kleene star, groups, and anchors, it probably shouldn't be done with regex.
This also ties into how I try to explain regex to people: A lot of the symbols are just shorthands for other symbol combinations:
a+
is the same asaa*
.a?
is the same asa|
. Technically, even[ab]
is justa|b
. It's obviously a lot easier to write the shorthands - but the actual feature set you really need and want can all be boiled down into^(|)*$
and that's wonderful. (Named and non-matching groups notwithstanding, of course.)Hello Tapajyoti Bose,
thank you for your article.
I think I'll find it useful when I start working with regex again, as I'm no real expert.
I especially like how you added an example with a sample match for better understanding.
Thanks for sharing this list.
Normally, I never know how to regex. Just opening regexr.com and try different patterns.
Nice work, and of course the required XKCD: xkcd.com/208/
As a corollary, the inimitable Jeff Atwood: blog.codinghorror.com/regular-expr...
😄
very well written with examples, thank you
I like Regex 101 because it has all of that information right where you can write and test your regex.
Thanks for providing this
Woww, niice!
Nice
Nice one, thanks for sharing.
BEST Cheatsheet for Regex: Regex Cheatsheet
One of the most complete regex documentation sites, and one that I use for many years: regular-expressions.info/