Formatting the Output of Regular Expressions

Learn about the components of regular expressions and the art of desired outputs from regular expressions.

Components of a regular expression

Below are the basic components that make up a regular expression:

Characters : These appear in the string being matched. For example, the characters a and b appear in the string abc.

Metacharacters : These have a special meaning in a regular expression. For example, the metacharacter . (dot) matches any character.

Quantifiers : These specify how many of the previous characters, or groups of characters, must be present. For example, the quantifier * (asterisk) means “zero or more occurrences.”

Regular Expression Options : These change the way a regular expression is matched. For example, the i (ignore case) or RegexOptions.IgnoreCase option means that the case should be ignored when matching.

Get hands-on with 1400+ tech skills courses.