Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Basic Regex tutorial for designers :)

Regex tutorial

References

Basics

Anchors

^ - Start of the line

$ - End of the line

Flags

g - Global

m - Multiline

i- Insensitive

s - Single line

Quantifiers

*- From 0 to infinite

+ - From 1 to infinite

?- From 0 to 1

{n} - Exactly n

{n1, n2} - From n1 to n2

Characters

\d - Digits

\D - Non digits

\w - Words

\W - Non words

\s - Space and break lines

\n - New line

\t - Tab

\udddd - Unicode (where dddd is the hexadecimal code for a Unicode character)

. - Any character

Special characters

\- \character

\. - . character

\$- $character

\^ - ^ character

Operators

| - "Or" operator

[] - "Any" operator

[abc]or (a|b|c) - Any of a, b or c

[a-c]- Any from a to c

[^abc]- Any except a, b and c

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.