X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0aa7fa9afdd1499d06b56bcff8adcd4adb6ca3f7..619111b9aa66549dd55fec55c07be63d5b19ae88:/docs/latex/wx/regex.tex?ds=inline

diff --git a/docs/latex/wx/regex.tex b/docs/latex/wx/regex.tex
index 89542cff7c..27c4928c74 100644
--- a/docs/latex/wx/regex.tex
+++ b/docs/latex/wx/regex.tex
@@ -33,7 +33,7 @@ the library.
 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 wxWindows.
+the wxWidgets.
 
 \wxheading{Derived from}
 
@@ -98,22 +98,26 @@ is bad because the real email addresses can have more complicated form than
 \begin{verbatim}
 wxString text;
 ...
-wxRegEx reEmail = "([^@]+)@([[:alnum:].-_].)+([[:alnum:]]+)";
+wxRegEx reEmail = wxT("([^@]+)@([[:alnum:].-_].)+([[:alnum:]]+)");
 if ( reEmail.Matches(text) )
 {
     wxString text = reEmail.GetMatch(email);
     wxString username = reEmail.GetMatch(email, 1);
-    if ( reEmail.GetMatch(email, 3) == "com" ) // .com TLD?
+    if ( reEmail.GetMatch(email, 3) == wxT("com") ) // .com TLD?
     {
         ...
     }
 }
 
 // or we could do this to hide the email address
-size_t count = reEmail.ReplaceAll(text, "HIDDEN@\\2\\3");
+size_t count = reEmail.ReplaceAll(text, wxT("HIDDEN@\\2\\3"));
 printf("text now contains %u hidden addresses", count);
 \end{verbatim}
 
+\wxheading{Include files}
+
+<wx/regex.h>
+
 \latexignore{\rtfignore{\wxheading{Members}}}
 
 \membersection{wxRegEx::wxRegEx}\label{wxregexwxregex}
@@ -159,7 +163,7 @@ May only be called after successful call to \helpref{Matches()}{wxregexmatches}
 and only if {\tt wxRE\_NOSUB} was {\bf not} used in 
 \helpref{Compile()}{wxregexcompile}.
 
-Returns {\tt false} if no match or if an error occured.
+Returns {\tt false} if no match or if an error occurred.
 
 \constfunc{wxString}{GetMatch}{\param{const wxString\& }{text}, \param{size\_t }{index = 0}}
 
@@ -170,14 +174,38 @@ May only be called after successful call to \helpref{Matches()}{wxregexmatches}
 and only if {\tt wxRE\_NOSUB} was {\bf not} used in 
 \helpref{Compile()}{wxregexcompile}.
 
+\membersection{wxRegEx::GetMatchCount}\label{wxregexgetmatchcount}
+
+\constfunc{size\_t}{GetMatchCount}{\void}
+
+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.
+
+May only be called after successful call to \helpref{Compile()}{wxregexcompile}.
+and only if {\tt wxRE\_NOSUB} was {\bf not} used.
+
 \membersection{wxRegEx::Matches}\label{wxregexmatches}
 
 \constfunc{bool}{Matches}{\param{const wxChar* }{text}, \param{int }{flags = 0}}
 
+\constfunc{bool}{Matches}{\param{const wxChar* }{text}, \param{int }{flags}, \param{size\_t }{len}}
+
+\constfunc{bool}{Matches}{\param{const wxString\& }{text}, \param{int }{flags = 0}}
+
 Matches the precompiled regular expression against the string {\it text},
 returns {\tt true} if matches and {\tt false} otherwise.
 
-Flags may be combination of {\tt wxRE\_NOTBOL} and {\tt wxRE\_NOTEOL}.
+{\it Flags} may be combination of {\tt wxRE\_NOTBOL} and {\tt wxRE\_NOTEOL}.
+
+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 {\it text} cannot contain embedded nulls.
+
+When the {\it Matches(const wxChar *text, int flags = 0)} form is used,
+a {\it wxStrlen()} will be done internally if the regex library requires the
+length. When using {\it Matches()} in a loop
+the {\it Matches(text, flags, len)} form can be used instead, making it
+possible to avoid a {\it wxStrlen()} inside the loop.
 
 May only be called after successful call to \helpref{Compile()}{wxregexcompile}.
 
