In
D toc |
---|
Excerpt | |
---|---|
In
|
...
A capture group |
...
is a pattern that describes a set of one or more characters that constitute a match. These matches can be programmatically referenced in replacement values. |
- These patterns are described using regular expression syntax.
implements a version of regular expressions based off of RE2 and PCRE regular expressions.D s product
...
D trans | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Reference | Description | ||||
---|---|---|---|---|---|
{start} | A
| ||||
(%+) | Matches on one or more characters of any time.
| ||||
Last character in the matching pattern is an empty space. |
...
D trans | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Reference | Description | |||||
---|---|---|---|---|---|---|
first character in the second capture group is an empty space. | ||||||
| | Logical OR, which means that the capture group matches on either the empty space or the following value, which is a reference to the end of the tested value. | |||||
{end} | A |
...
D trans | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
source value | Replace transformation | replacement | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
foobar |
| $foobar | ||||||||||||||||||||||||||||
foobar |
Note that the
| o |
Positive and Negative Lookaheads
...
Type | Example expression | |||
---|---|---|---|---|
Positive lookahead |
| Capture the letter q only when it is followed by the letter u . Letter u is not captured. | ||
Negative lookahead |
| Capture the letter q when it is not followed by the letter u . Letter u is not captured. |
D s also | ||||
---|---|---|---|---|
|