--- code/trunk/doc/html/pcrecpp.html 2007/02/24 21:41:21 87 +++ code/trunk/doc/html/pcrecpp.html 2007/03/08 16:53:09 111 @@ -16,20 +16,20 @@
The C++ wrapper for PCRE was provided by Google Inc. Some additional @@ -105,12 +105,33 @@ number of sub-patterns, "i"th captured sub-pattern is ignored. +CAVEAT: An optional sub-pattern that does not exist in the matched +string is assigned the empty string. Therefore, the following will +return false (because the empty string is not a valid number): +
+ int number; + pcrecpp::RE::FullMatch("abc", "[a-z]+(\\d+)?", &number); +The matching interface supports at most 16 arguments per call. If you need more, consider using the more general interface pcrecpp::RE::DoMatch. See pcrecpp.h for the signature for DoMatch. -
+You can use the "QuoteMeta" operation to insert backslashes before all +potentially meaningful characters in a string. The returned string, used as a +regular expression, will exactly match the original string. +
+ Example: + string quoted = RE::QuoteMeta(unquoted); ++Note that it's legal to escape a character even if it has no special meaning in +a regular expression -- so this function does that. (This also makes it +identical to the perl function of the same name; see "perldoc -f quotemeta".) +For example, "1.5-2.0?" becomes "1\.5\-2\.0\?". + +
You can use the "PartialMatch" operation when you want the pattern to match any substring of the text. @@ -125,7 +146,7 @@ assert(number == 100);-
By default, pattern and text are plain text, one byte per character. The UTF8 flag, passed to the constructor, causes both pattern and string to be treated @@ -150,7 +171,7 @@ --enable-utf8 flag.-
PCRE defines some modifiers to change the behavior of the regular expression engine. The C++ wrapper defines an auxiliary class, RE_Options, as a vehicle to @@ -244,7 +265,7 @@-
The "Consume" operation may be useful if you want to repeatedly match regular expressions at the front of a string and skip over @@ -277,7 +298,7 @@ pcrecpp::RE("(\\w+)").FindAndConsume(&input, &word)-
By default, if you pass a pointer to a numeric value, the corresponding text is interpreted as a base-10 number. You can @@ -295,7 +316,7 @@ will leave 64 in a, b, c, and d.-
You can replace the first match of "pattern" in "str" with "rewrite". Within "rewrite", backslash-escaped digits (\1 to \9) can be @@ -327,11 +348,17 @@ occurred and the extraction happened successfully; if no match occurs, the string is left unaffected.-
The C++ wrapper was contributed by Google Inc.
-Copyright © 2005 Google Inc. +Copyright © 2006 Google Inc. +
+Last updated: 06 March 2007
Return to the PCRE index page.