std.regexp
Regular expressions are a powerful method of string pattern matching. The regular expression language used is the same as that commonly used, however, some of the very advanced forms may behave slightly differently.

std.regexp is designed to work only with valid UTF strings as input. To validate untrusted input, use std.utf.validate().

In the following guide, pattern[] refers to a regular expression. The attributes[] refers to a string controlling the interpretation of the regular expression. It consists of a sequence of one or more of the following characters:

Attribute Characters
Attribute Action
g global; repeat over the whole input string
i case insensitive
m treat as multiple lines separated by newlines

The format[] string has the formatting characters:

Formatting Characters
Format Replaced With
$$ $
$& The matched substring.
$` The portion of string that precedes the matched substring.
$' The portion of string that follows the matched substring.
$ n The nth capture, where n is a single digit 1-9 and $n is not followed by a decimal digit.
$ nn The nnth capture, where nn is a two-digit decimal number 01-99. If nnth capture is undefined or more than the number of parenthesized subexpressions, use the empty string instead.

Any other $ are left as is.

References:
Wikipedia