File: format_boost_syntax.html

package info (click to toggle)
boost 1.34.1-14
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 116,412 kB
  • ctags: 259,566
  • sloc: cpp: 642,395; xml: 56,450; python: 17,612; ansic: 14,520; sh: 2,265; yacc: 858; perl: 481; makefile: 478; lex: 94; sql: 74; csh: 6
file content (163 lines) | stat: -rw-r--r-- 6,626 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
   <head>
      <title>Boost.Regex: Boost-Extended Format String Syntax</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <link rel="stylesheet" type="text/css" href="../../../boost.css">
   </head>
   <body>
      <P>
         <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0">
            <TR>
               <td valign="top" width="300">
                  <h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../boost.png" border="0"></a></h3>
               </td>
               <TD width="353">
                  <H1 align="center">Boost.Regex</H1>
                  <H2 align="center">Boost-Extended Format String Syntax</H2>
               </TD>
               <td width="50">
                  <h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
               </td>
            </TR>
         </TABLE>
      </P>
      <P>Boost-Extended&nbsp;format strings treat all characters as literals except for 
         '$', '\', '(', ')', '?', ':' and '\'.</P>
      <H4>Grouping</H4>
      <P>The characters '(' and ')' perform lexical grouping, use \( and \) if you want 
         a to output literal parenthesis.</P>
      <H4>Conditionals</H4>
      <P>The character '?' begins a conditional expression, the general form is:</P>
      <PRE>?Ntrue-expression:false-expression</PRE>
      <P>where N is decimal digit.</P>
      <P>If sub-expression <EM>N</EM> was matched, then true-expression is evaluated and 
         sent to output, otherwise false-expression is evaluated and sent to output.</P>
      <P>You will normally need to surround a conditional-expression with parenthesis in 
         order to prevent ambiguities.</P>
      <H4>Placeholder Sequences</H4>
      <P>Placeholder sequences specify that some part of what matched the regular 
         expression should be sent to output as follows:</P>
      <P>
         <TABLE id="Table2" cellSpacing="4" cellPadding="1" width="100%" border="0">
            <TR>
               <TD><STRONG>Placeholder</STRONG></TD>
               <TD><STRONG>Meaning</STRONG></TD>
            </TR>
            <TR>
               <TD>$&amp;</TD>
               <TD>Outputs what matched the whole expression.</TD>
            </TR>
            <TR>
               <TD>$`</TD>
               <TD>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.</TD>
            </TR>
            <TR>
               <TD>$'</TD>
               <TD>Outputs all the text following the end of the current match.</TD>
            </TR>
            <TR>
               <TD>$$</TD>
               <TD>Outputs a literal '$'</TD>
            </TR>
            <TR>
               <TD>$n</TD>
               <TD>Outputs what matched the n'th sub-expression.</TD>
            </TR>
         </TABLE>
      </P>
      <P>Any $-placeholder sequence not listed above, results in '$' being treated as a 
         literal.</P>
      <H4>Escape Sequences</H4>
      <P>An escape character followed by any character <EM>x</EM>, outputs that 
         character unless <EM>x</EM> is one of the escape sequences shown below.</P>
      <P>
         <TABLE id="Table3" cellSpacing="4" cellPadding="1" width="100%" border="0">
            <TR>
               <TD><STRONG>Escape</STRONG></TD>
               <TD><STRONG>Meaning</STRONG></TD>
            </TR>
            <TR>
               <TD>\a</TD>
               <TD>Outputs the bell character: '\a'.</TD>
            </TR>
            <TR>
               <TD>\e</TD>
               <TD>Outputs the ANSI escape character (code point 27).</TD>
            </TR>
            <TR>
               <TD>\f</TD>
               <TD>Outputs a form feed character: '\f'</TD>
            </TR>
            <TR>
               <TD>\n</TD>
               <TD>Outputs a newline character: '\n'.</TD>
            </TR>
            <TR>
               <TD>\r</TD>
               <TD>Outputs a carriage return character: '\r'.</TD>
            </TR>
            <TR>
               <TD>\t</TD>
               <TD>Outputs a tab character: '\t'.</TD>
            </TR>
            <TR>
               <TD>\v</TD>
               <TD>Outputs a vertical tab character: '\v'.</TD>
            </TR>
            <TR>
               <TD>\xDD</TD>
               <TD>Outputs the character whose hexadecimal code point is 0xDD</TD>
            </TR>
            <TR>
               <TD>\x{DDDD}</TD>
               <TD>Outputs the character whose hexadecimal code point is 0xDDDDD</TD>
            </TR>
            <TR>
               <TD>\cX</TD>
               <TD>Outputs the ANSI escape sequence "escape-X".</TD>
            </TR>
            <TR>
               <TD>\D</TD>
               <TD>If <EM>D</EM> is a decimal digit in the range 1-9, then outputs the text that 
                  matched sub-expression <EM>D</EM>.</TD>
            </TR>
            <TR>
               <TD>\l</TD>
               <TD>Causes the next character to be outputted, to be output in lower case.</TD>
            </TR>
            <TR>
               <TD>\u</TD>
               <TD>Causes the next character to be outputted, to be output in upper case.</TD>
            </TR>
            <TR>
               <TD>\L</TD>
               <TD>Causes all subsequent characters to be output in lower case, until a \E is 
                  found.</TD>
            </TR>
            <TR>
               <TD>\U</TD>
               <TD>Causes all subsequent characters to be output in upper case, until a \E is 
                  found.</TD>
            </TR>
            <TR>
               <TD>\E</TD>
               <TD>Terminates a \L or \U sequence.</TD>
            </TR>
         </TABLE>
      </P>
      <P>
         <HR>
      <P></P>
      <P></P>
      <p>Revised 
         <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> 
         24 Nov 2004 
         <!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
      <p><i> Copyright John Maddock&nbsp;2004</i></p>
      <P><I>Use, modification and distribution are subject to the Boost Software License, 
            Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
            or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
   </body>
</html>