^ caret denotes start of the expression. ^ negate the character class in the range like [^123] must not match with 1,2 or 3. $ denotes end of the expression. . means any single character: letter, number or whitespace. $1 refers to the first match. $2 refers to the second match. is used to match literals like . itself as a.b means match a.b i modifier at the end to make regex case insensitive. [] bracket are used for character sets like /a[123]b/ it should not match with a4b - Hyphen denotes range like /a[1-5]b/ repetition operators * means 0 ore more times. + means 1 or more time. here /a[123]+b/