\section{KReg\-Exp Class Reference}
\label{classKRegExp}\index{KRegExp@{KRegExp}}
{\tt \#include $<$kregexp.h$>$}

Collaboration diagram for KReg\-Exp:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=65pt]{classKRegExp__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KReg\-Exp} ()
\item 
{\bf KReg\-Exp} (const char $\ast$\_\-pattern, const char $\ast$\_\-mode=\char`\"{}\char`\"{})
\item 
bool {\bf compile} (const char $\ast$\_\-pattern, const char $\ast$\_\-mode=\char`\"{}\char`\"{})
\item 
bool {\bf match} (const char $\ast$\_\-string)
\item 
const char $\ast$ {\bf group} (int \_\-grp)
\item 
int {\bf group\-Start} (int \_\-grp)
\item 
int {\bf group\-End} (int \_\-grp)
\end{CompactItemize}


\subsection{Detailed Description}
\begin{Desc}
\item[{\bf Deprecated}]Please use {\bf QReg\-Exp} instead. \end{Desc}
Regular expression (regexp) matching with back-references.

This was implemented because {\bf QReg\-Exp} did not support back-references. It now does and is recommended over KReg\-Exp because of the unicode support and the more powerful API.

Back-references are parts of a regexp grouped with parentheses. If a string matches the regexp, you can access the text that matched each group with the group method. This is similar to regular expressions in Perl.

Example: 

\footnotesize\begin{verbatim}  KRegExp ex( "([A-Za-z]+) (.+)" );
  ex.match( "42 Torben Weis" );
  kdDebug() << ex.group(0) << endl;
  kdDebug() << ex.group(1) << endl;
  kdDebug() << ex.group(2) << endl;
\end{verbatim}
\normalsize
 Output: 

\footnotesize\begin{verbatim}  Torben Weis
  Torben
  Weis
\end{verbatim}
\normalsize


Please notice that KReg\-Exp does {\em not\/} support unicode.

\begin{Desc}
\item[Author:]Torben Weis $<${\tt weis@kde.org}$>$ \end{Desc}




Definition at line 60 of file kregexp.h.

\subsection{Constructor \& Destructor Documentation}
\index{KRegExp@{KReg\-Exp}!KRegExp@{KRegExp}}
\index{KRegExp@{KRegExp}!KRegExp@{KReg\-Exp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KReg\-Exp::KReg\-Exp ()}\label{classKRegExp_a0}


Creates a KReg\-Exp object without a default pattern. 



Definition at line 143 of file kregexp.cpp.\index{KRegExp@{KReg\-Exp}!KRegExp@{KRegExp}}
\index{KRegExp@{KRegExp}!KRegExp@{KReg\-Exp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KReg\-Exp::KReg\-Exp (const char $\ast$ {\em \_\-pattern}, const char $\ast$ {\em \_\-mode} = {\tt \char`\"{}\char`\"{}})}\label{classKRegExp_a1}


Creates a KReg\-Exp object. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-pattern}]The regular expression to use for matches. \item[{\em \_\-mode}]If this is \char`\"{}i\char`\"{}, case-insensitive matches will be performed. \end{description}
\end{Desc}


Definition at line 148 of file kregexp.cpp.

\subsection{Member Function Documentation}
\index{KRegExp@{KReg\-Exp}!compile@{compile}}
\index{compile@{compile}!KRegExp@{KReg\-Exp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KReg\-Exp::compile (const char $\ast$ {\em \_\-pattern}, const char $\ast$ {\em \_\-mode} = {\tt \char`\"{}\char`\"{}})}\label{classKRegExp_a3}


Prepare a regular expression for subsequent matches. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-pattern}]The regular expression to use for matches. \item[{\em \_\-mode}]If this is \char`\"{}i\char`\"{}, case-insensitive matches will be performed. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]bool if successful. \end{Desc}


Definition at line 158 of file kregexp.cpp.

References KReg\-Exp\-Private::compile().\index{KRegExp@{KReg\-Exp}!match@{match}}
\index{match@{match}!KRegExp@{KReg\-Exp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KReg\-Exp::match (const char $\ast$ {\em \_\-string})}\label{classKRegExp_a4}


Match a string to the last supplied regexp. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-string}]the string to match \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt true} on match, false otherwise. \end{Desc}


Definition at line 163 of file kregexp.cpp.

References KReg\-Exp\-Private::match().\index{KRegExp@{KReg\-Exp}!group@{group}}
\index{group@{group}!KRegExp@{KReg\-Exp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char $\ast$ KReg\-Exp::group (int {\em \_\-grp})}\label{classKRegExp_a5}


Returns a group from the match. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-grp}]May be in the range [0..9]. If {\tt \_\-grp} is 0 then the complete matched string is returned. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a grouped substring. A substring may be empty. In this case 0 is returned. Otherwise you may {\em not\/} delete or modify the returned value. In addition the returned value becomes invalid after the KReg\-Exp instance is deleted or after {\bf match()}{\rm (p.\,\pageref{classKRegExp_a4})} was called again. \end{Desc}


Definition at line 168 of file kregexp.cpp.

References KReg\-Exp\-Private::group().\index{KRegExp@{KReg\-Exp}!groupStart@{groupStart}}
\index{groupStart@{groupStart}!KRegExp@{KReg\-Exp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KReg\-Exp::group\-Start (int {\em \_\-grp})}\label{classKRegExp_a6}


The offset of the given group in the string. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-grp}]May be in the range [0..9]. If {\tt \_\-grp} is 0 then the start offset of the complete matched string is returned. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The start offset of the grouped substring. \end{Desc}


Definition at line 173 of file kregexp.cpp.

References KReg\-Exp\-Private::group\-Start().\index{KRegExp@{KReg\-Exp}!groupEnd@{groupEnd}}
\index{groupEnd@{groupEnd}!KRegExp@{KReg\-Exp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KReg\-Exp::group\-End (int {\em \_\-grp})}\label{classKRegExp_a7}


The offset of the given group's end in the string. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-grp}]May be in the range [0..9]. If {\tt \_\-grp} is 0 then the end offset of the complete matched string is returned. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The end offset of the grouped substring. The \char`\"{}end offset\char`\"{} is the first character after the string. \end{Desc}


Definition at line 178 of file kregexp.cpp.

References KReg\-Exp\-Private::group\-End().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kregexp.h\item 
kregexp.cpp\end{CompactItemize}
