RayCC

RegExp cheat sheet

1 min

Regexp Study Cheatsheet

?X?0 or 1
*X*0 or many
+X+more then 0
{N}X{N}N times
{N,}X{N, }more then N
{N, M}X{N, M}more then N, less then M
^^Xstart with X
$X$end with X
[0-9]number
[a-z]lower case alphabet
[A-Z]upper case alphabet
[a-zA-z0-9.-]alphabet, number, dot, hyphen
[X^Y]X without Y
.any letter without \n
\d[0-9]
\D[^0-9]
\w[a-zA-Z0-9_]
\W[^a-zA-Z0-9_]
\s[\f\n\r\t\v]
\S[^\f\n\r\t\v]
\fformfeed, \n LF, \r CR, \t tab, \v vertical tab
//
..

PATTERN

\11st matched sub-expression
\22nd matched sub-expression
(?=PATTERN)lookahead
(?!PATTERN)negative lookahead
?(BR)EXif BR is true, then EX
?(BR)EX1|EX2if BR is true, then EX1, else EX2

EX

email/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/