blog.ratterobert.com

prologic (twtxt.net)

Regex Isn't Hard - Tim Kellogg 👈 this is a pretty good conscience article on regexes, and I agree, regex isn't that hard™ -- However I think I can make the TL;DR even shorter 😅


Regex core subset (portable across languages):

Character sets • a matches “a” • [a-z] any lowercase • [a-zA-Z0-9] alphanumeric • [^ab] any char but a or b

Repetition (applies to the preceding atom) • ? zero or one • * zero or more • + one or more

Groups • (ab)+ matches “ab”, “abab”, … • Capture for extract/substitute via $1 or \1

Operators • foo|bar = foo or bar • ^ start anchor • $ end anchor

Ignore non‑portable shortcuts: \w, ., {n}, *?, lookarounds.

#regex101

Read replies 3 weeks ago
Reply via email