Codecabulary Home / Learn Ruby / Regex Cheat Sheet

A single character of: a, b, or c:


Any single character except: a, b, or c:


Any single character in the range a-z:


Any case insensitive character in the range a-z


Line starts with:

	^		# Match URLs starting with blog: /^blog/

Line ends with:

	$ 		# Match URLs ending with /$blog/

Any word boundary:

	\b 		# Effectively implied. Match URLs containing. /\bblog\b/ is the same as /blog/.

Start of string:


End of string:


Any single character:


Any whitespace character:


Any non-whitespace character:


Any digit:


Any non-digit:


Any word character (letter, number, underscore):


Any non-word character:


Capture everything enclosed:


a or b:


Zero or one of a:


Zero or more of a:


One or more of a:


Exactly 3 of a:


Three or more of a:

	a{3, }

Between three and six of a:

	a{3, 6}