vinod's erudition

we learn everything from failure not from success so keep failing

Home Ruby Rails Javascript Python Agentic AI

Regex cheats

Posted on March 18, 2014 by vinod

####Regex Cheats:

abc…	Letters
 	123…	Digits
 	\d	any Digit
 	.	any Character
 	\.	Period
 	[abc]	Only a, b, or c
 	[^abc]	Not a, b, nor c
 	[a-z]	Characters a to z
 	[0-9]	Numbers 0 to 9
 	{m}	m Repetitions
 	{m,n}	m to n Repetitions
 	*	Zero or more repetitions
 	+	One or more repetitions
 	?	Optional
 	\s	any Whitespace
 	^…$	Starts and ends
 	()	capture Group
 	(a(bc))	capture Sub group
 	(.*)	capture Variable content
 	(a|b)	Matchs a or b
 	\w	any Alphanumeric character
 	\W	any Non-alphanumeric character
 	\d	any Digit
 	\D	any Non-digit character
 	\s	any Whitespace
 	\S	any Non-whitespace character