General Wolfram Language patterns provide a powerful way to do string manipulation. But particularly if you are familiar with specialized string manipulation languages, you may sometimes find it convenient to specify string patterns using regular expression notation. You can do this in the Wolfram Language with RegularExpression objects.
Correspondences between regular expression and general string pattern constructs.
Just as in general Wolfram Language string patterns, there are special notations in regular expressions for various common classes of characters. Note that you need to use double backslashes (∖∖) to enter most of these notations in Wolfram Language regular expression strings.
Regular expression notations for positions in strings.
In general Wolfram Language patterns, you can use constructs like x_ and x:patt to give arbitrary names to objects that are matched. In regular expressions, there is a way to do something somewhat like this using numbering: the n parenthesized pattern object (p) in a regular expression can be referred to as \\n within the body of the pattern, and $n outside it.
This finds pairs of identical letters that appear together:
This does the same thing using a general Wolfram Language string pattern: