Skip to content

Latest commit

Β 

History

History
63 lines (47 loc) Β· 2.09 KB

File metadata and controls

63 lines (47 loc) Β· 2.09 KB

🧩 Regex

πŸ“• Notebooks

🚩 Meta Characters

🎎 Character Matches

πŸŽ€ Symbol πŸ“ƒ Description
. Single character
^ Start of a string
$ End of a string
[] One of the set of characters within []
[a-z] One of the range of characters
[^abc] Not a, b or c
[ab] a or b (a and b are strings)
() Scoping for operators
(?:<pattern>) Passive grouping (details)
\ Escape character

πŸŽ‡ Character Symbols

πŸŽ€ Symbol πŸ“ƒ Description 🀯 Equivalent
\b Word boundary
\d Any digit [0-9]
\D Any non-digit [^0-9]
\s Any whitespace [ \t\n\r\f\v]
\S Any non-whitespace [^ \t\n\r\f\v]
\w Alphanumeric character [a-zA-Z0-9_]
\W Non-alphanumeric character [^a-zA-Z0-9_]

πŸ’« Repetitions

πŸŽ€ Symbol πŸ“ƒ Description
* Zero or more occurrences
+ One or more occurrences
? Zero or one occurrences
{n} Exactly n repetitions
{n,} At least n repetitions
{,n} At most n repetitions
{m,n} At least m and at most n repetitions

🧐 Useful Examples

🧩 Regex πŸ“œ Description
^.*SOME_STRING.*\n Finds all lines start with specific string

πŸ”— References