Skip to content

Instantly share code, notes, and snippets.

@uqmessias
Created May 15, 2019 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uqmessias/303e70807560ab7cfb1dbc0dbb280f42 to your computer and use it in GitHub Desktop.
Save uqmessias/303e70807560ab7cfb1dbc0dbb280f42 to your computer and use it in GitHub Desktop.
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