Regex in Golang

Regular expression a.k.a Regex is a sequence of characters that define a search pattern

Cheat sheet

xyx followed by y
x|yx or y, prefer x
xy|zsame as (xy)|z
xy*same as x(y*)
^matches the beginning of the string
$matches the end of the string
.matches any single character except line break
*matches the preceding expression zero or more times
\dany single digit character
wany word (alphanumeric & underscore) [0-9A-Za-z_]
Wany character that is not a word [^0-9A-Za-z_]
Dany character that is not a digit
Sa non-whitespace character: [^ ]
[abc]any single character from the character within the brackets
[a-z]character set range from a to z
[abc]+one or more characters from the set
[^a-z]match anything without the character range
+one or more
{3}exactly 3 times
{2,4}2 to 4 times
{3,}3 or more times
*zero or more times
?once or none
x*zero or more x, prefer more
x*?prefer fewer (non-greedy)
x+one or more x, prefer more
x+?prefer fewer (non-greedy)
x?zero or one x, prefer one
x??prefer zero
x{n}exactly n x
mlet ^ and $ match begin/end line in addition to begin/end text (multi-line mode)
slet . match (single-line mode)

Docker up and running - notes