251
The design is very human
(piefedimages.s3.eu-central-003.backblazeb2.com)
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Here is my cheatsheet that has been very helpful. Obviously, this will not teach you how RegEx works, but is a good quick reference when I forget the exact syntax for something.
RegExp
Character classes
.
\w
\d
\s
\W
\D
\S
[abc]
[a-e]
a
ande
[1-9]
1
and9
[[:print:]]
[^abc]
a
,b
orc
Anchors
\G
^
$
\A
\Z
\z
\b
\B
^abc
abc
abc$
abc
For multiline patterns (
m
flag),^
and$
will act as start and end of line.Escaped characters
\. \* \\
\t
\n
\r
Groups
(abc)
(a|b)
a
orb
(?:abc)
abc
, but don't capture\1
Quantifiers
a*
a+
a?
a{5}
a{,3}
a{3,}
a{1,3}
Lookahead & Lookbehind
| Pattern | Description | |
|
a(?=b)
| Matcha
inbaby
but not inbay
| |a(?!b)
| Matcha
inStan
but not inStab
| |(?<=a)b
| Matchb
incrabs
but not incribs
| |(?<!a)b
| Matchb
infib
but not infab
| |(?<![a-z])abc(?![a-z])
| Matchabc
without any letters before/after |Raw Markdown