]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/regex/doc/format_perl_syntax.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / regex / doc / format_perl_syntax.qbk
CommitLineData
7c673cae
FG
1[/
2 Copyright 2006-2007 John Maddock.
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt).
6]
7
8
9[section:perl_format Perl Format String Syntax]
10
11Perl-style format strings treat all characters as literals except
12'$' and '\\' which start placeholder and escape sequences respectively.
13
14Placeholder sequences specify that some part of what matched the regular expression
15should be sent to output as follows:
16
17[table
18[[Placeholder][Meaning]]
19[[$&][Outputs what matched the whole expression.]]
20[[$MATCH][As $&]]
21[[${^MATCH}][As $&]]
22[[$\`][Outputs the text between the end of the last match found (or the
23 start of the text if no previous match was found), and the start
24 of the current match.]]
25[[$PREMATCH][As $\`]]
26[[${^PREMATCH}][As $\`]]
27[[$'][Outputs all the text following the end of the current match.]]
28[[$POSTMATCH][As $']]
29[[${^POSTMATCH}][As $']]
30[[$+][Outputs what matched the last marked sub-expression in the regular expression.]]
31[[$LAST_PAREN_MATCH][As $+]]
32[[$LAST_SUBMATCH_RESULT][Outputs what matched the last sub-expression to be actually matched.]]
33[[$^N][As $LAST_SUBMATCH_RESULT]]
34[[$$][Outputs a literal '$']]
35[[$n][Outputs what matched the n'th sub-expression.]]
36[[${n}][Outputs what matched the n'th sub-expression.]]
37[[$+{NAME}][Outputs whatever matched the sub-expression named "NAME".]]
38]
39
40Any $-placeholder sequence not listed above, results in '$' being treated
41as a literal.
42
43An escape character followed by any character x, outputs that character unless
44x is one of the escape sequences shown below.
45
46
47[table
48[[Escape][Meaning]]
49[[\\a][Outputs the bell character: '\\a'.]]
50[[\\e][Outputs the ANSI escape character (code point 27).]]
51[[\\f][Outputs a form feed character: '\\f']]
52[[\\n][Outputs a newline character: '\\n'.]]
53[[\\r][Outputs a carriage return character: '\\r'.]]
54[[\\t][Outputs a tab character: '\\t'.]]
55[[\\v][Outputs a vertical tab character: '\\v'.]]
56[[\\xDD][Outputs the character whose hexadecimal code point is 0xDD]]
57[[\\x{DDDD}][Outputs the character whose hexadecimal code point is 0xDDDDD]]
58[[\\cX][Outputs the ANSI escape sequence "escape-X".]]
59[[\\D][If D is a decimal digit in the range 1-9, then outputs the text that matched sub-expression D.]]
60[[\\l][Causes the next character to be outputted, to be output in lower case.]]
61[[\\u][Causes the next character to be outputted, to be output in upper case.]]
62[[\\L][Causes all subsequent characters to be output in lower case, until a \\E is found.]]
63[[\\U][Causes all subsequent characters to be output in upper case, until a \\E is found.]]
64[[\\E][Terminates a \\L or \\U sequence.]]
65]
66
67[endsect]
68
69