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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wxWidgets: wxRegEx Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="page_container">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" style="width: 100%;">
<tbody>
<tr>
<td id="projectlogo">
<a href="http://www.wxwidgets.org/" target="_new">
<img alt="wxWidgets" src="logo.png"/>
</a>
</td>
<td style="padding-left: 0.5em; text-align: right;">
<span id="projectnumber">Version: 3.0.2</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.2 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Categories</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="classwx_reg_ex-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">wxRegEx Class Reference<div class="ingroups"><a class="el" href="group__group__class__data.html">Data Structures</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <wx/regex.h></code></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classwx_reg_ex.html" title="wxRegEx represents a regular expression.">wxRegEx</a> represents a regular expression. </p>
<p>This class provides support for regular expressions matching and also replacement.</p>
<p>It is built on top of either the system library (if it has support for POSIX regular expressions - which is the case of the most modern Unices) or uses the built in Henry Spencer's library. Henry Spencer would appreciate being given credit in the documentation of software which uses his library, but that is not a requirement.</p>
<p>Regular expressions, as defined by POSIX, come in two flavours: <em>extended</em> and <em>basic</em>. The builtin library also adds a third flavour of expression <a class="el" href="overview_resyntax.html">advanced</a>, which is not available when using the system library.</p>
<p>Unicode is fully supported only when using the builtin library. When using the system library in Unicode mode, the expressions and data are translated to the default 8-bit encoding before being passed to the library.</p>
<p>On platforms where a system library is available, the default is to use the builtin library for Unicode builds, and the system library otherwise. It is possible to use the other if preferred by selecting it when building the wxWidgets.</p>
<h2></h2>
<div><span class="lib">Library:</span>  <span class="lib_text"><a class="el" href="page_libs.html#page_libs_wxbase">wxBase</a></span></div><div><span class="category">Category:</span>  <span class="category_text"><a class="el" href="group__group__class__data.html">Data Structures</a></span></div><p>Examples:</p>
<p>A bad example of processing some text containing email addresses (the example is bad because the real email addresses can have more complicated form than <code><a href="#" onclick="location.href='mai'+'lto:'+'use'+'r@'+'hos'+'t.'+'net'; return false;">user@<span style="display: none;">.nosp@m.</span>host<span style="display: none;">.nosp@m.</span>.net</a></code>):</p>
<div class="fragment"><div class="line"><a class="code" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a> text;</div>
<div class="line">...</div>
<div class="line">wxRegEx reEmail = <span class="stringliteral">"([^@]+)@([[:alnum:].-_].)+([[:alnum:]]+)"</span>;</div>
<div class="line"><span class="keywordflow">if</span> ( reEmail.Matches(text) )</div>
<div class="line">{</div>
<div class="line"> <a class="code" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a> text = reEmail.GetMatch(email);</div>
<div class="line"> <a class="code" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a> username = reEmail.GetMatch(email, 1);</div>
<div class="line"> <span class="keywordflow">if</span> ( reEmail.GetMatch(email, 3) == <span class="stringliteral">"com"</span> ) <span class="comment">// .com TLD?</span></div>
<div class="line"> {</div>
<div class="line"> ...</div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="comment">// or we could do this to hide the email address</span></div>
<div class="line"><span class="keywordtype">size_t</span> count = reEmail.ReplaceAll(text, <span class="stringliteral">"HIDDEN@\\2\\3"</span>);</div>
<div class="line">printf(<span class="stringliteral">"text now contains %u hidden addresses"</span>, count);</div>
</div><!-- fragment --> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a6e10e9fd01041501fa31c17bf133b09f"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#a6e10e9fd01041501fa31c17bf133b09f">wxRegEx</a> ()</td></tr>
<tr class="memdesc:a6e10e9fd01041501fa31c17bf133b09f"><td class="mdescLeft"> </td><td class="mdescRight">Default constructor: use <a class="el" href="classwx_reg_ex.html#acd01c4ab52213184f89a1e9a36bc1a24" title="Compile the string into regular expression, return true if ok or false if string has a syntax error...">Compile()</a> later. <a href="#a6e10e9fd01041501fa31c17bf133b09f"></a><br/></td></tr>
<tr class="separator:a6e10e9fd01041501fa31c17bf133b09f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a840f38773d86b3e8d6b02c120331c2cb"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#a840f38773d86b3e8d6b02c120331c2cb">wxRegEx</a> (const <a class="el" href="classwx_string.html">wxString</a> &expr, int flags=<a class="el" href="regex_8h.html#a2970898e8a43ce21e1cc510d49f1b89da2acc242d92915c6dc6f507d6be56b171">wxRE_DEFAULT</a>)</td></tr>
<tr class="memdesc:a840f38773d86b3e8d6b02c120331c2cb"><td class="mdescLeft"> </td><td class="mdescRight">Create and compile the regular expression, use <a class="el" href="classwx_reg_ex.html#ae19a386efd8c012bdcfdd1548dd64dfc" title="Return true if this is a valid compiled regular expression, false otherwise.">IsValid()</a> to test for compilation errors. <a href="#a840f38773d86b3e8d6b02c120331c2cb"></a><br/></td></tr>
<tr class="separator:a840f38773d86b3e8d6b02c120331c2cb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aaf75e99c2dbe5fe8e798c64b1e510355"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#aaf75e99c2dbe5fe8e798c64b1e510355">~wxRegEx</a> ()</td></tr>
<tr class="memdesc:aaf75e99c2dbe5fe8e798c64b1e510355"><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#aaf75e99c2dbe5fe8e798c64b1e510355"></a><br/></td></tr>
<tr class="separator:aaf75e99c2dbe5fe8e798c64b1e510355"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:acd01c4ab52213184f89a1e9a36bc1a24"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#acd01c4ab52213184f89a1e9a36bc1a24">Compile</a> (const <a class="el" href="classwx_string.html">wxString</a> &pattern, int flags=<a class="el" href="regex_8h.html#a2970898e8a43ce21e1cc510d49f1b89da2acc242d92915c6dc6f507d6be56b171">wxRE_DEFAULT</a>)</td></tr>
<tr class="memdesc:acd01c4ab52213184f89a1e9a36bc1a24"><td class="mdescLeft"> </td><td class="mdescRight">Compile the string into regular expression, return <span class="literal">true</span> if ok or <span class="literal">false</span> if string has a syntax error. <a href="#acd01c4ab52213184f89a1e9a36bc1a24"></a><br/></td></tr>
<tr class="separator:acd01c4ab52213184f89a1e9a36bc1a24"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7b2b15b023a36603084a6b8b9fcf84fd"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#a7b2b15b023a36603084a6b8b9fcf84fd">GetMatch</a> (size_t *start, size_t *len, size_t index=0) const </td></tr>
<tr class="memdesc:a7b2b15b023a36603084a6b8b9fcf84fd"><td class="mdescLeft"> </td><td class="mdescRight">Get the start index and the length of the match of the expression (if <em>index</em> is 0) or a bracketed subexpression (<em>index</em> different from 0). <a href="#a7b2b15b023a36603084a6b8b9fcf84fd"></a><br/></td></tr>
<tr class="separator:a7b2b15b023a36603084a6b8b9fcf84fd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abccca0f3b75c5fe54b02deeb90c09f4d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classwx_string.html">wxString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#abccca0f3b75c5fe54b02deeb90c09f4d">GetMatch</a> (const <a class="el" href="classwx_string.html">wxString</a> &text, size_t index=0) const </td></tr>
<tr class="memdesc:abccca0f3b75c5fe54b02deeb90c09f4d"><td class="mdescLeft"> </td><td class="mdescRight">Returns the part of string corresponding to the match where index is interpreted as above. <a href="#abccca0f3b75c5fe54b02deeb90c09f4d"></a><br/></td></tr>
<tr class="separator:abccca0f3b75c5fe54b02deeb90c09f4d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab6b4ab7bcb567c452b04549ebff81bba"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#ab6b4ab7bcb567c452b04549ebff81bba">GetMatchCount</a> () const </td></tr>
<tr class="memdesc:ab6b4ab7bcb567c452b04549ebff81bba"><td class="mdescLeft"> </td><td class="mdescRight">Returns the size of the array of matches, i.e. the number of bracketed subexpressions plus one for the expression itself, or 0 on error. <a href="#ab6b4ab7bcb567c452b04549ebff81bba"></a><br/></td></tr>
<tr class="separator:ab6b4ab7bcb567c452b04549ebff81bba"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae19a386efd8c012bdcfdd1548dd64dfc"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#ae19a386efd8c012bdcfdd1548dd64dfc">IsValid</a> () const </td></tr>
<tr class="memdesc:ae19a386efd8c012bdcfdd1548dd64dfc"><td class="mdescLeft"> </td><td class="mdescRight">Return <span class="literal">true</span> if this is a valid compiled regular expression, <span class="literal">false</span> otherwise. <a href="#ae19a386efd8c012bdcfdd1548dd64dfc"></a><br/></td></tr>
<tr class="separator:ae19a386efd8c012bdcfdd1548dd64dfc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aac3f3acd35f8daf37ab2837473188e6a"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#aac3f3acd35f8daf37ab2837473188e6a">Matches</a> (const <a class="el" href="classwx_string.html">wxString</a> &text, int flags=0) const </td></tr>
<tr class="memdesc:aac3f3acd35f8daf37ab2837473188e6a"><td class="mdescLeft"> </td><td class="mdescRight">Matches the precompiled regular expression against the string <em>text</em>, returns <span class="literal">true</span> if matches and <span class="literal">false</span> otherwise. <a href="#aac3f3acd35f8daf37ab2837473188e6a"></a><br/></td></tr>
<tr class="separator:aac3f3acd35f8daf37ab2837473188e6a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6b581649802549cb7c9c9774f0367fe0"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#a6b581649802549cb7c9c9774f0367fe0">Replace</a> (<a class="el" href="classwx_string.html">wxString</a> *text, const <a class="el" href="classwx_string.html">wxString</a> &replacement, size_t maxMatches=0) const </td></tr>
<tr class="memdesc:a6b581649802549cb7c9c9774f0367fe0"><td class="mdescLeft"> </td><td class="mdescRight">Replaces the current regular expression in the string pointed to by <em>text</em>, with the text in <em>replacement</em> and return number of matches replaced (maybe 0 if none found) or -1 on error. <a href="#a6b581649802549cb7c9c9774f0367fe0"></a><br/></td></tr>
<tr class="separator:a6b581649802549cb7c9c9774f0367fe0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aeda59d47a50f59511a9b5b14aa847ac2"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#aeda59d47a50f59511a9b5b14aa847ac2">ReplaceAll</a> (<a class="el" href="classwx_string.html">wxString</a> *text, const <a class="el" href="classwx_string.html">wxString</a> &replacement) const </td></tr>
<tr class="memdesc:aeda59d47a50f59511a9b5b14aa847ac2"><td class="mdescLeft"> </td><td class="mdescRight">Replace all occurrences: this is actually a synonym for <a class="el" href="classwx_reg_ex.html#a6b581649802549cb7c9c9774f0367fe0" title="Replaces the current regular expression in the string pointed to by text, with the text in replacemen...">Replace()</a>. <a href="#aeda59d47a50f59511a9b5b14aa847ac2"></a><br/></td></tr>
<tr class="separator:aeda59d47a50f59511a9b5b14aa847ac2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a22d68765f9807178f537edc04849e6e8"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#a22d68765f9807178f537edc04849e6e8">ReplaceFirst</a> (<a class="el" href="classwx_string.html">wxString</a> *text, const <a class="el" href="classwx_string.html">wxString</a> &replacement) const </td></tr>
<tr class="memdesc:a22d68765f9807178f537edc04849e6e8"><td class="mdescLeft"> </td><td class="mdescRight">Replace the first occurrence. <a href="#a22d68765f9807178f537edc04849e6e8"></a><br/></td></tr>
<tr class="separator:a22d68765f9807178f537edc04849e6e8"><td class="memSeparator" colspan="2"> </td></tr>
<tr><td colspan="2"><div class="groupHeader"></div></td></tr>
<tr class="memitem:a4f63e65c83d19d7f4115e0cb46d797f2"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#a4f63e65c83d19d7f4115e0cb46d797f2">Matches</a> (const <a class="el" href="group__group__funcmacro__string.html#gad42f64d8c82f1ce4ae58773a89b2d6a7">wxChar</a> *text, int flags=0) const </td></tr>
<tr class="memdesc:a4f63e65c83d19d7f4115e0cb46d797f2"><td class="mdescLeft"> </td><td class="mdescRight">Matches the precompiled regular expression against the string <em>text</em>, returns <span class="literal">true</span> if matches and <span class="literal">false</span> otherwise. <a href="#a4f63e65c83d19d7f4115e0cb46d797f2"></a><br/></td></tr>
<tr class="separator:a4f63e65c83d19d7f4115e0cb46d797f2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a761c31d59bc171d4c526e7d1da76ec9f"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_reg_ex.html#a761c31d59bc171d4c526e7d1da76ec9f">Matches</a> (const <a class="el" href="group__group__funcmacro__string.html#gad42f64d8c82f1ce4ae58773a89b2d6a7">wxChar</a> *text, int flags, size_t len) const </td></tr>
<tr class="memdesc:a761c31d59bc171d4c526e7d1da76ec9f"><td class="mdescLeft"> </td><td class="mdescRight">Matches the precompiled regular expression against the string <em>text</em>, returns <span class="literal">true</span> if matches and <span class="literal">false</span> otherwise. <a href="#a761c31d59bc171d4c526e7d1da76ec9f"></a><br/></td></tr>
<tr class="separator:a761c31d59bc171d4c526e7d1da76ec9f"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a class="anchor" id="a6e10e9fd01041501fa31c17bf133b09f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxRegEx::wxRegEx </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Default constructor: use <a class="el" href="classwx_reg_ex.html#acd01c4ab52213184f89a1e9a36bc1a24" title="Compile the string into regular expression, return true if ok or false if string has a syntax error...">Compile()</a> later. </p>
</div>
</div>
<a class="anchor" id="a840f38773d86b3e8d6b02c120331c2cb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxRegEx::wxRegEx </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>expr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flags</em> = <code><a class="el" href="regex_8h.html#a2970898e8a43ce21e1cc510d49f1b89da2acc242d92915c6dc6f507d6be56b171">wxRE_DEFAULT</a></code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Create and compile the regular expression, use <a class="el" href="classwx_reg_ex.html#ae19a386efd8c012bdcfdd1548dd64dfc" title="Return true if this is a valid compiled regular expression, false otherwise.">IsValid()</a> to test for compilation errors. </p>
<p>As for the flags, please see <a class="el" href="regex_8h.html#wxRE_FLAGS">wxRE_FLAGS</a>. </p>
</div>
</div>
<a class="anchor" id="aaf75e99c2dbe5fe8e798c64b1e510355"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxRegEx::~wxRegEx </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Destructor. </p>
<p>It's not virtual, don't derive from this class. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="acd01c4ab52213184f89a1e9a36bc1a24"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxRegEx::Compile </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>pattern</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flags</em> = <code><a class="el" href="regex_8h.html#a2970898e8a43ce21e1cc510d49f1b89da2acc242d92915c6dc6f507d6be56b171">wxRE_DEFAULT</a></code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Compile the string into regular expression, return <span class="literal">true</span> if ok or <span class="literal">false</span> if string has a syntax error. </p>
<p>As for the flags, please see <a class="el" href="regex_8h.html#wxRE_FLAGS">wxRE_FLAGS</a>. </p>
</div>
</div>
<a class="anchor" id="a7b2b15b023a36603084a6b8b9fcf84fd"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxRegEx::GetMatch </td>
<td>(</td>
<td class="paramtype">size_t * </td>
<td class="paramname"><em>start</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t * </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>index</em> = <code>0</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the start index and the length of the match of the expression (if <em>index</em> is 0) or a bracketed subexpression (<em>index</em> different from 0). </p>
<p>May only be called after successful call to <a class="el" href="classwx_reg_ex.html#a4f63e65c83d19d7f4115e0cb46d797f2" title="Matches the precompiled regular expression against the string text, returns true if matches and false...">Matches()</a> and only if <code>wxRE_NOSUB</code> was <b>not</b> used in <a class="el" href="classwx_reg_ex.html#acd01c4ab52213184f89a1e9a36bc1a24" title="Compile the string into regular expression, return true if ok or false if string has a syntax error...">Compile()</a>.</p>
<p>Returns <span class="literal">false</span> if no match or if an error occurred. </p>
</div>
</div>
<a class="anchor" id="abccca0f3b75c5fe54b02deeb90c09f4d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classwx_string.html">wxString</a> wxRegEx::GetMatch </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>index</em> = <code>0</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the part of string corresponding to the match where index is interpreted as above. </p>
<p>Empty string is returned if match failed.</p>
<p>May only be called after successful call to <a class="el" href="classwx_reg_ex.html#a4f63e65c83d19d7f4115e0cb46d797f2" title="Matches the precompiled regular expression against the string text, returns true if matches and false...">Matches()</a> and only if <code>wxRE_NOSUB</code> was <b>not</b> used in <a class="el" href="classwx_reg_ex.html#acd01c4ab52213184f89a1e9a36bc1a24" title="Compile the string into regular expression, return true if ok or false if string has a syntax error...">Compile()</a>. </p>
</div>
</div>
<a class="anchor" id="ab6b4ab7bcb567c452b04549ebff81bba"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t wxRegEx::GetMatchCount </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the size of the array of matches, i.e. the number of bracketed subexpressions plus one for the expression itself, or 0 on error. </p>
<p>May only be called after successful call to <a class="el" href="classwx_reg_ex.html#acd01c4ab52213184f89a1e9a36bc1a24" title="Compile the string into regular expression, return true if ok or false if string has a syntax error...">Compile()</a>. and only if <code>wxRE_NOSUB</code> was <b>not</b> used. </p>
</div>
</div>
<a class="anchor" id="ae19a386efd8c012bdcfdd1548dd64dfc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxRegEx::IsValid </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Return <span class="literal">true</span> if this is a valid compiled regular expression, <span class="literal">false</span> otherwise. </p>
</div>
</div>
<a class="anchor" id="a4f63e65c83d19d7f4115e0cb46d797f2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxRegEx::Matches </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__group__funcmacro__string.html#gad42f64d8c82f1ce4ae58773a89b2d6a7">wxChar</a> * </td>
<td class="paramname"><em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flags</em> = <code>0</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Matches the precompiled regular expression against the string <em>text</em>, returns <span class="literal">true</span> if matches and <span class="literal">false</span> otherwise. </p>
<p><em>Flags</em> may be combination of <code>wxRE_NOTBOL</code> and <code>wxRE_NOTEOL</code>, see <a class="el" href="regex_8h.html#wxRE_NOT_FLAGS">wxRE_NOT_FLAGS</a>.</p>
<p>Some regex libraries assume that the text given is null terminated, while others require the length be given as a separate parameter. Therefore for maximum portability assume that <em>text</em> cannot contain embedded nulls.</p>
<p>When the <b>Matches(const wxChar *text, int flags = 0)</b> form is used, a <a class="el" href="group__group__funcmacro__crt.html#ga8ee0fe62cfc16ac60a217e825dcf4ba5">wxStrlen()</a> will be done internally if the regex library requires the length. When using <a class="el" href="classwx_reg_ex.html#a4f63e65c83d19d7f4115e0cb46d797f2" title="Matches the precompiled regular expression against the string text, returns true if matches and false...">Matches()</a> in a loop the <b>Matches(text, flags, len)</b> form can be used instead, making it possible to avoid a <a class="el" href="group__group__funcmacro__crt.html#ga8ee0fe62cfc16ac60a217e825dcf4ba5">wxStrlen()</a> inside the loop.</p>
<p>May only be called after successful call to <a class="el" href="classwx_reg_ex.html#acd01c4ab52213184f89a1e9a36bc1a24" title="Compile the string into regular expression, return true if ok or false if string has a syntax error...">Compile()</a>. </p>
</div>
</div>
<a class="anchor" id="a761c31d59bc171d4c526e7d1da76ec9f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxRegEx::Matches </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__group__funcmacro__string.html#gad42f64d8c82f1ce4ae58773a89b2d6a7">wxChar</a> * </td>
<td class="paramname"><em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Matches the precompiled regular expression against the string <em>text</em>, returns <span class="literal">true</span> if matches and <span class="literal">false</span> otherwise. </p>
<p><em>Flags</em> may be combination of <code>wxRE_NOTBOL</code> and <code>wxRE_NOTEOL</code>, see <a class="el" href="regex_8h.html#wxRE_NOT_FLAGS">wxRE_NOT_FLAGS</a>.</p>
<p>Some regex libraries assume that the text given is null terminated, while others require the length be given as a separate parameter. Therefore for maximum portability assume that <em>text</em> cannot contain embedded nulls.</p>
<p>When the <b>Matches(const wxChar *text, int flags = 0)</b> form is used, a <a class="el" href="group__group__funcmacro__crt.html#ga8ee0fe62cfc16ac60a217e825dcf4ba5">wxStrlen()</a> will be done internally if the regex library requires the length. When using <a class="el" href="classwx_reg_ex.html#a4f63e65c83d19d7f4115e0cb46d797f2" title="Matches the precompiled regular expression against the string text, returns true if matches and false...">Matches()</a> in a loop the <b>Matches(text, flags, len)</b> form can be used instead, making it possible to avoid a <a class="el" href="group__group__funcmacro__crt.html#ga8ee0fe62cfc16ac60a217e825dcf4ba5">wxStrlen()</a> inside the loop.</p>
<p>May only be called after successful call to <a class="el" href="classwx_reg_ex.html#acd01c4ab52213184f89a1e9a36bc1a24" title="Compile the string into regular expression, return true if ok or false if string has a syntax error...">Compile()</a>. </p>
</div>
</div>
<a class="anchor" id="aac3f3acd35f8daf37ab2837473188e6a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxRegEx::Matches </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flags</em> = <code>0</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Matches the precompiled regular expression against the string <em>text</em>, returns <span class="literal">true</span> if matches and <span class="literal">false</span> otherwise. </p>
<p><em>Flags</em> may be combination of <code>wxRE_NOTBOL</code> and <code>wxRE_NOTEOL</code>, see <a class="el" href="regex_8h.html#wxRE_NOT_FLAGS">wxRE_NOT_FLAGS</a>.</p>
<p>May only be called after successful call to <a class="el" href="classwx_reg_ex.html#acd01c4ab52213184f89a1e9a36bc1a24" title="Compile the string into regular expression, return true if ok or false if string has a syntax error...">Compile()</a>. </p>
</div>
</div>
<a class="anchor" id="a6b581649802549cb7c9c9774f0367fe0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int wxRegEx::Replace </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classwx_string.html">wxString</a> * </td>
<td class="paramname"><em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>replacement</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>maxMatches</em> = <code>0</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Replaces the current regular expression in the string pointed to by <em>text</em>, with the text in <em>replacement</em> and return number of matches replaced (maybe 0 if none found) or -1 on error. </p>
<p>The replacement text may contain back references <code>\number</code> which will be replaced with the value of the corresponding subexpression in the pattern match. <code>\0</code> corresponds to the entire match and <code>&</code> is a synonym for it. Backslash may be used to quote itself or <code>&</code> character.</p>
<p><em>maxMatches</em> may be used to limit the number of replacements made, setting it to 1, for example, will only replace first occurrence (if any) of the pattern in the text while default value of 0 means replace all. </p>
</div>
</div>
<a class="anchor" id="aeda59d47a50f59511a9b5b14aa847ac2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int wxRegEx::ReplaceAll </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classwx_string.html">wxString</a> * </td>
<td class="paramname"><em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>replacement</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Replace all occurrences: this is actually a synonym for <a class="el" href="classwx_reg_ex.html#a6b581649802549cb7c9c9774f0367fe0" title="Replaces the current regular expression in the string pointed to by text, with the text in replacemen...">Replace()</a>. </p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classwx_reg_ex.html#a22d68765f9807178f537edc04849e6e8" title="Replace the first occurrence.">ReplaceFirst()</a> </dd></dl>
</div>
</div>
<a class="anchor" id="a22d68765f9807178f537edc04849e6e8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int wxRegEx::ReplaceFirst </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classwx_string.html">wxString</a> * </td>
<td class="paramname"><em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>replacement</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Replace the first occurrence. </p>
</div>
</div>
</div><!-- contents -->
<address class="footer">
<small>
Generated on Thu Nov 27 2014 13:46:54 for wxWidgets by <a href="http://www.doxygen.org/index.html" target="_new">Doxygen</a> 1.8.2
</small>
</address>
<script src="wxwidgets.js" type="text/javascript"></script>
</div><!-- #page_container -->
</body>
</html>
|