Regular Expressions is a sequence of characters that defines a search pattern for text

Table of Contents


Literal Characters


Meta characters


Meta Character WTF is it ?
\d any digit that can be from 0-9
\w A-Z a-z 0-9 ( alphanumeric and underscore)
\W other than A-Z a-z 0-9
\s white space
\S other than whitespace
. any character whatsoever
* 0 or more
.* wildcard (matches anything)

Quantifiers


Quantifier WTF is it?
* 0 or more
+ one or more ( atleast one)
? 0 or one ( optional)
{min,max} Min, max
{n} n characters

Position


Position WTF is it?
^ begining
$ end
\b word boundary
\B not a word boundary

Flags