A regular expression is a series of characters that define a search pattern.
\b is a word boundary (before first \w in matched string, between a \w and \W, after last \w)/\bis\b/ would match "This is cool", not "This is cool" because it needs to start at a word boundary? after any quantifier (*?, {1,5}? etc...) is Lazy quantifier (no ? is called greedy). Lazy matches as few as possible() capturing and (?: ) non-capturing used to group part of the regex and apply quantifiers.\1, \2 match the first and second capturing groups again (references). (\w)(\w)\w\2\1 will match any 5 letter palindrome(b?)o\1 matches "o" where b? matches nothing so \1 doesn't either(b)?o\1 fails to match "o" for most flavors (except JavaScript). (b) is optional, o matches, \1 references a group that did not participate so backreference fails (\1 has nothing to reference).(?|regex) is used to choose on from multiple possible capturing groups and assigns it to one given group number(x)(?|(a)|(bc)|(def))\2 matches xaa, xbcbc, or xdefdef, each assigned to number 2