match_flag_type.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>match_flag_type</title>
  5. <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
  7. <link rel="home" href="../../index.html" title="Boost.Regex 5.1.4">
  8. <link rel="up" href="../ref.html" title="Reference">
  9. <link rel="prev" href="syntax_option_type/syntax_option_type_literal.html" title="Options for Literal Strings">
  10. <link rel="next" href="error_type.html" title="error_type">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr>
  14. <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
  15. <td align="center"><a href="../../../../../../index.html">Home</a></td>
  16. <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
  17. <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
  18. <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
  19. <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
  20. </tr></table>
  21. <hr>
  22. <div class="spirit-nav">
  23. <a accesskey="p" href="syntax_option_type/syntax_option_type_literal.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="error_type.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="section">
  26. <div class="titlepage"><div><div><h3 class="title">
  27. <a name="boost_regex.ref.match_flag_type"></a><a class="link" href="match_flag_type.html" title="match_flag_type">match_flag_type</a>
  28. </h3></div></div></div>
  29. <p>
  30. The type <code class="computeroutput"><span class="identifier">match_flag_type</span></code>
  31. is an implementation specific bitmask type (see C++ std 17.3.2.1.2) that
  32. controls how a regular expression is matched against a character sequence.
  33. The behavior of the format flags is described in more detail in the <a class="link" href="../format.html" title="Search and Replace Format String Syntax">format syntax guide</a>.
  34. </p>
  35. <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">regex_constants</span><span class="special">{</span>
  36. <span class="keyword">typedef</span> <span class="identifier">implemenation</span><span class="special">-</span><span class="identifier">specific</span><span class="special">-</span><span class="identifier">bitmask</span><span class="special">-</span><span class="identifier">type</span> <span class="identifier">match_flag_type</span><span class="special">;</span>
  37. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_default</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
  38. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_bob</span><span class="special">;</span>
  39. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_eob</span><span class="special">;</span>
  40. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_bol</span><span class="special">;</span>
  41. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_eol</span><span class="special">;</span>
  42. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_bow</span><span class="special">;</span>
  43. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_eow</span><span class="special">;</span>
  44. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_any</span><span class="special">;</span>
  45. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_null</span><span class="special">;</span>
  46. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_continuous</span><span class="special">;</span>
  47. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_partial</span><span class="special">;</span>
  48. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_single_line</span><span class="special">;</span>
  49. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_prev_avail</span><span class="special">;</span>
  50. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_dot_newline</span><span class="special">;</span>
  51. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_not_dot_null</span><span class="special">;</span>
  52. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_posix</span><span class="special">;</span>
  53. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_perl</span><span class="special">;</span>
  54. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_nosubs</span><span class="special">;</span>
  55. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">match_extra</span><span class="special">;</span>
  56. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_default</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
  57. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_sed</span><span class="special">;</span>
  58. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_perl</span><span class="special">;</span>
  59. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_literal</span><span class="special">;</span>
  60. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_no_copy</span><span class="special">;</span>
  61. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_first_only</span><span class="special">;</span>
  62. <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">match_flag_type</span> <span class="identifier">format_all</span><span class="special">;</span>
  63. <span class="special">}</span> <span class="comment">// namespace regex_constants</span>
  64. <span class="special">}</span> <span class="comment">// namespace boost</span>
  65. </pre>
  66. <h5>
  67. <a name="boost_regex.ref.match_flag_type.h0"></a>
  68. <span class="phrase"><a name="boost_regex.ref.match_flag_type.description"></a></span><a class="link" href="match_flag_type.html#boost_regex.ref.match_flag_type.description">Description</a>
  69. </h5>
  70. <p>
  71. The type <code class="computeroutput"><span class="identifier">match_flag_type</span></code>
  72. is an implementation specific bitmask type (see C++ std 17.3.2.1.2). When
  73. matching a regular expression against a sequence of characters [first, last)
  74. then setting its elements has the effects listed in the table below:
  75. </p>
  76. <div class="informaltable"><table class="table">
  77. <colgroup>
  78. <col>
  79. <col>
  80. </colgroup>
  81. <thead><tr>
  82. <th>
  83. <p>
  84. Element
  85. </p>
  86. </th>
  87. <th>
  88. <p>
  89. Effect if set
  90. </p>
  91. </th>
  92. </tr></thead>
  93. <tbody>
  94. <tr>
  95. <td>
  96. <p>
  97. match_default
  98. </p>
  99. </td>
  100. <td>
  101. <p>
  102. Specifies that matching of regular expressions proceeds without
  103. any modification of the normal rules used in ECMA-262, ECMAScript
  104. Language Specification, Chapter 15 part 10, RegExp (Regular Expression)
  105. Objects (FWD.1)
  106. </p>
  107. </td>
  108. </tr>
  109. <tr>
  110. <td>
  111. <p>
  112. match_not_bob
  113. </p>
  114. </td>
  115. <td>
  116. <p>
  117. Specifies that the expressions "\A" and "\`"
  118. should not match against the sub-sequence [first,first).
  119. </p>
  120. </td>
  121. </tr>
  122. <tr>
  123. <td>
  124. <p>
  125. match_not_eob
  126. </p>
  127. </td>
  128. <td>
  129. <p>
  130. Specifies that the expressions "\'", "\z" and
  131. "\Z" should not match against the sub-sequence [last,last).
  132. </p>
  133. </td>
  134. </tr>
  135. <tr>
  136. <td>
  137. <p>
  138. match_not_bol
  139. </p>
  140. </td>
  141. <td>
  142. <p>
  143. Specifies that the expression "^" should not be matched
  144. against the sub-sequence [first,first).
  145. </p>
  146. </td>
  147. </tr>
  148. <tr>
  149. <td>
  150. <p>
  151. match_not_eol
  152. </p>
  153. </td>
  154. <td>
  155. <p>
  156. Specifies that the expression "$" should not be matched
  157. against the sub-sequence [last,last).
  158. </p>
  159. </td>
  160. </tr>
  161. <tr>
  162. <td>
  163. <p>
  164. match_not_bow
  165. </p>
  166. </td>
  167. <td>
  168. <p>
  169. Specifies that the expressions "\&lt;" and "\b"
  170. should not be matched against the sub-sequence [first,first).
  171. </p>
  172. </td>
  173. </tr>
  174. <tr>
  175. <td>
  176. <p>
  177. match_not_eow
  178. </p>
  179. </td>
  180. <td>
  181. <p>
  182. Specifies that the expressions "\&gt;" and "\b"
  183. should not be matched against the sub-sequence [last,last).
  184. </p>
  185. </td>
  186. </tr>
  187. <tr>
  188. <td>
  189. <p>
  190. match_any
  191. </p>
  192. </td>
  193. <td>
  194. <p>
  195. Specifies that if more than one match is possible then any match
  196. is an acceptable result: this will still find the leftmost match,
  197. but may not find the "best" match at that position. Use
  198. this flag if you care about the speed of matching, but don't care
  199. what was matched (only whether there is one or not).
  200. </p>
  201. </td>
  202. </tr>
  203. <tr>
  204. <td>
  205. <p>
  206. match_not_null
  207. </p>
  208. </td>
  209. <td>
  210. <p>
  211. Specifies that the expression can not be matched against an empty
  212. sequence.
  213. </p>
  214. </td>
  215. </tr>
  216. <tr>
  217. <td>
  218. <p>
  219. match_continuous
  220. </p>
  221. </td>
  222. <td>
  223. <p>
  224. Specifies that the expression must match a sub-sequence that begins
  225. at first.
  226. </p>
  227. </td>
  228. </tr>
  229. <tr>
  230. <td>
  231. <p>
  232. match_partial
  233. </p>
  234. </td>
  235. <td>
  236. <p>
  237. Specifies that if no match can be found, then it is acceptable
  238. to return a match [from, last) such that from!= last, if there
  239. could exist some longer sequence of characters [from,to) of which
  240. [from,last) is a prefix, and which would result in a full match.
  241. This flag is used when matching incomplete or very long texts,
  242. see the partial matches documentation for more information.
  243. </p>
  244. </td>
  245. </tr>
  246. <tr>
  247. <td>
  248. <p>
  249. match_extra
  250. </p>
  251. </td>
  252. <td>
  253. <p>
  254. Instructs the matching engine to retain all available capture information;
  255. if a capturing group is repeated then information about every repeat
  256. is available via match_results::captures() or sub_match_captures().
  257. </p>
  258. </td>
  259. </tr>
  260. <tr>
  261. <td>
  262. <p>
  263. match_single_line
  264. </p>
  265. </td>
  266. <td>
  267. <p>
  268. Equivalent to the inverse of Perl's m/ modifier; prevents ^ from
  269. matching after an embedded newline character (so that it only matches
  270. at the start of the text being matched), and $ from matching before
  271. an embedded newline (so that it only matches at the end of the
  272. text being matched).
  273. </p>
  274. </td>
  275. </tr>
  276. <tr>
  277. <td>
  278. <p>
  279. match_prev_avail
  280. </p>
  281. </td>
  282. <td>
  283. <p>
  284. Specifies that --first is a valid iterator position, when this
  285. flag is set then the flags match_not_bol and match_not_bow are
  286. ignored by the regular expression algorithms (RE.7) and iterators
  287. (RE.8).
  288. </p>
  289. </td>
  290. </tr>
  291. <tr>
  292. <td>
  293. <p>
  294. match_not_dot_newline
  295. </p>
  296. </td>
  297. <td>
  298. <p>
  299. Specifies that the expression "." does not match a newline
  300. character. This is the inverse of Perl's s/ modifier.
  301. </p>
  302. </td>
  303. </tr>
  304. <tr>
  305. <td>
  306. <p>
  307. match_not_dot_null
  308. </p>
  309. </td>
  310. <td>
  311. <p>
  312. Specifies that the expression "." does not match a character
  313. null '\0'.
  314. </p>
  315. </td>
  316. </tr>
  317. <tr>
  318. <td>
  319. <p>
  320. match_posix
  321. </p>
  322. </td>
  323. <td>
  324. <p>
  325. Specifies that the expression should be matched according to the
  326. POSIX <a class="link" href="../syntax/leftmost_longest_rule.html" title="The Leftmost Longest Rule">leftmost-longest
  327. rule</a>, regardless of what kind of expression was compiled.
  328. Be warned that these rules do not work well with many Perl-specific
  329. features such as non-greedy repeats.
  330. </p>
  331. </td>
  332. </tr>
  333. <tr>
  334. <td>
  335. <p>
  336. match_perl
  337. </p>
  338. </td>
  339. <td>
  340. <p>
  341. Specifies that the expression should be matched according to the
  342. <a class="link" href="../syntax/perl_syntax.html#boost_regex.syntax.perl_syntax.what_gets_matched">Perl
  343. matching rules</a>, irrespective of what kind of expression
  344. was compiled.
  345. </p>
  346. </td>
  347. </tr>
  348. <tr>
  349. <td>
  350. <p>
  351. match_nosubs
  352. </p>
  353. </td>
  354. <td>
  355. <p>
  356. Makes the expression behave as if it had no marked subexpressions,
  357. no matter how many capturing groups are actually present. The
  358. <a class="link" href="match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a>
  359. class will only contain information about the overall match, and
  360. not any sub-expressions.
  361. </p>
  362. </td>
  363. </tr>
  364. <tr>
  365. <td>
  366. <p>
  367. format_default
  368. </p>
  369. </td>
  370. <td>
  371. <p>
  372. Specifies that when a regular expression match is to be replaced
  373. by a new string, that the new string is constructed using the rules
  374. used by the ECMAScript replace function in ECMA-262, ECMAScript
  375. Language Specification, Chapter 15 part 5.4.11 String.prototype.replace.
  376. (FWD.1).
  377. </p>
  378. <p>
  379. This is functionally identical to the <a class="link" href="../format/perl_format.html" title="Perl Format String Syntax">Perl
  380. format string rules</a>.
  381. </p>
  382. <p>
  383. In addition during search and replace operations then all non-overlapping
  384. occurrences of the regular expression are located and replaced,
  385. and sections of the input that did not match the expression, are
  386. copied unchanged to the output string.
  387. </p>
  388. </td>
  389. </tr>
  390. <tr>
  391. <td>
  392. <p>
  393. format_sed
  394. </p>
  395. </td>
  396. <td>
  397. <p>
  398. Specifies that when a regular expression match is to be replaced
  399. by a new string, that the new string is constructed using the rules
  400. used by the Unix sed utility in IEEE Std 1003.1-2001, Portable
  401. Operating SystemInterface (POSIX ), Shells and Utilities. See also
  402. the <a class="link" href="../format/sed_format.html" title="Sed Format String Syntax">Sed Format string
  403. reference</a>.
  404. </p>
  405. </td>
  406. </tr>
  407. <tr>
  408. <td>
  409. <p>
  410. format_perl
  411. </p>
  412. </td>
  413. <td>
  414. <p>
  415. Specifies that when a regular expression match is to be replaced
  416. by a new string, that the new string is constructed using <a class="link" href="../format/perl_format.html" title="Perl Format String Syntax">the same rules as Perl
  417. 5</a>.
  418. </p>
  419. </td>
  420. </tr>
  421. <tr>
  422. <td>
  423. <p>
  424. format_literal
  425. </p>
  426. </td>
  427. <td>
  428. <p>
  429. Specifies that when a regular expression match is to be replaced
  430. by a new string, that the new string is a literal copy of the replacement
  431. text.
  432. </p>
  433. </td>
  434. </tr>
  435. <tr>
  436. <td>
  437. <p>
  438. format_all
  439. </p>
  440. </td>
  441. <td>
  442. <p>
  443. Specifies that all syntax extensions are enabled, including conditional
  444. (?ddexpression1:expression2) replacements: see the <a class="link" href="../format/boost_format_syntax.html" title="Boost-Extended Format String Syntax">format
  445. string guide</a> for more details.
  446. </p>
  447. </td>
  448. </tr>
  449. <tr>
  450. <td>
  451. <p>
  452. format_no_copy
  453. </p>
  454. </td>
  455. <td>
  456. <p>
  457. When specified during a search and replace operation, then sections
  458. of the character container sequence being searched that do match
  459. the regular expression, are not copied to the output string.
  460. </p>
  461. </td>
  462. </tr>
  463. <tr>
  464. <td>
  465. <p>
  466. format_first_only
  467. </p>
  468. </td>
  469. <td>
  470. <p>
  471. When specified during a search and replace operation, then only
  472. the first occurrence of the regular expression is replaced.
  473. </p>
  474. </td>
  475. </tr>
  476. </tbody>
  477. </table></div>
  478. </div>
  479. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  480. <td align="left"></td>
  481. <td align="right"><div class="copyright-footer">Copyright &#169; 1998-2013 John Maddock<p>
  482. Distributed under the Boost Software License, Version 1.0. (See accompanying
  483. file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
  484. </p>
  485. </div></td>
  486. </tr></table>
  487. <hr>
  488. <div class="spirit-nav">
  489. <a accesskey="p" href="syntax_option_type/syntax_option_type_literal.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="error_type.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
  490. </div>
  491. </body>
  492. </html>