Why use this formatter?
A regular expression, or regex for short, is a pattern describing a certain amount of text. On this website, regular expressions are shaded gray asregex. This is actually a perfectly valid regex. It is the most basic pattern, simply matching the literal textregex. Matches are highlighted in blue on this site. We use the term “string” to indicate the text that the regular expression is applied to. Strings are highlighted ingreen.
Characters with special meanings in regular expressions are highlighted in various different colors. The regex([Rr]egexp?)\?shows meta tokens in purple, grouping in green, character classes in orange, quantifiers and other special tokens in blue, and escaped characters in gray.
Here's a handy guide with some commonly used Regex: