forked from boostorg/regex
Add support for named and/or subexpressions with indexes > 99 in conditional format expressions.
[SVN r52873]
This commit is contained in:
@ -33,6 +33,15 @@ order to prevent ambiguities.
|
||||
For example, the format string "(?1foo:bar)" will replace each match found with "foo" if
|
||||
the sub-expression $1 was matched, and with "bar" otherwise.
|
||||
|
||||
For sub-expressions with an index greater than 9, or for access to named sub-expressions use:
|
||||
|
||||
?{INDEX}true-expression:false-expression
|
||||
|
||||
or
|
||||
|
||||
?{NAME}true-expression:false-expression
|
||||
|
||||
|
||||
[h4 Placeholder Sequences]
|
||||
|
||||
Placeholder sequences specify that some part of what matched the regular expression
|
||||
@ -41,12 +50,24 @@ should be sent to output as follows:
|
||||
[table
|
||||
[[Placeholder][Meaning]]
|
||||
[[$&][Outputs what matched the whole expression.]]
|
||||
[[$`][Outputs the text between the end of the last match found (or the
|
||||
start of the text if no previous match was found), and the start
|
||||
of the current match.]]
|
||||
[[$MATCH][As $&]]
|
||||
[[${^MATCH}][As $&]]
|
||||
[[$\`][Outputs the text between the end of the last match found (or the
|
||||
start of the text if no previous match was found), and the start
|
||||
of the current match.]]
|
||||
[[$PREMATCH][As $\`]]
|
||||
[[${^PREMATCH}][As $\`]]
|
||||
[[$'][Outputs all the text following the end of the current match.]]
|
||||
[[$POSTMATCH][As $']]
|
||||
[[${^POSTMATCH}][As $']]
|
||||
[[$+][Outputs what matched the last marked sub-expression in the regular expression.]]
|
||||
[[$LAST_PAREN_MATCH][As $+]]
|
||||
[[$LAST_SUBMATCH_RESULT][Outputs what matched the last sub-expression to be actually matched.]]
|
||||
[[$^N][As $LAST_SUBMATCH_RESULT]]
|
||||
[[$$][Outputs a literal '$']]
|
||||
[[$n][Outputs what matched the n'th sub-expression.]]
|
||||
[[${n}][Outputs what matched the n'th sub-expression.]]
|
||||
[[$+{NAME}][Outputs whatever matched the sub-expression named "NAME".]]
|
||||
]
|
||||
|
||||
Any $-placeholder sequence not listed above, results in '$' being treated as a literal.
|
||||
|
Reference in New Issue
Block a user