RegExp Class Reference

A regular expression. More...

#include <RegExp.h++>

List of all members.

Public Member Functions

 RegExp () throw ()
 Construct a new RegExp.
 RegExp (const RegExp &other) throw (ParseException)
 Copy constructor.
 ~RegExp () throw ()
 Destructor.
void setPattern (const char *pattern, bool caseInsensitive=false) throw (ParseException)
 Set the regular expression pattern.
void setPattern (const String &pattern, bool caseInsensitive=false) throw (ParseException)
 Set the regular expression pattern.
String getPattern () const
 Get the regular expression pattern.
String toString () const
 Get a String representation of the RegExp.
bool match (const char *text) const throw ()
 Perform a pattern match against some text.
bool match (const String &text) const throw ()
 Perform a pattern match against some text.
bool match (const char *text, RegExpMatch matches[], int numMatches) const throw ()
 Perform a pattern match against some text, returning submatches.
bool match (const String &text, RegExpMatch matches[], int numMatches) const throw ()
 Perform a pattern match against some text, returning submatches.
RegExpoperator= (const RegExp &other)
 Assignment operator.
bool isNull () const throw ()
 Determine if this regular expression has a null pattern.
bool operator! () const throw ()
 Determine if this regular expression has a null pattern.

Static Public Member Functions

static String escapeMeta (const String &text)
 Escape all metacharacters in a String.

Detailed Description

A regular expression.

Author:
Mark Lindner

Constructor & Destructor Documentation

RegExp (  )  throw ()

Construct a new RegExp.

RegExp ( const RegExp other  )  throw (ParseException)

Copy constructor.

~RegExp (  )  throw ()

Destructor.


Member Function Documentation

String escapeMeta ( const String text  )  [static]

Escape all metacharacters in a String.

Parameters:
text The String to escape.
Returns:
A copy of the string with all metacharacters escaped.
String getPattern (  )  const [inline]

Get the regular expression pattern.

bool isNull (  )  const throw () [inline]

Determine if this regular expression has a null pattern.

bool match ( const String text,
RegExpMatch  matches[],
int  numMatches 
) const throw ()

Perform a pattern match against some text, returning submatches.

Parameters:
text The text.
matches The objects in which the submatches will be recorded.
numMatches The number of submatches.
Returns:
true if the text matches the pattern, false otherwise.
bool match ( const char *  text,
RegExpMatch  matches[],
int  numMatches 
) const throw ()

Perform a pattern match against some text, returning submatches.

Parameters:
text The text.
matches The objects in which the submatches will be recorded.
numMatches The number of submatches.
Returns:
true if the text matches the pattern, false otherwise.
bool match ( const String text  )  const throw ()

Perform a pattern match against some text.

Parameters:
text The text.
Returns:
true if the text matches the pattern, false otherwise.
bool match ( const char *  text  )  const throw ()

Perform a pattern match against some text.

Parameters:
text The text.
Returns:
true if the text matches the pattern, false otherwise.
bool operator! (  )  const throw () [inline]

Determine if this regular expression has a null pattern.

RegExp & operator= ( const RegExp other  ) 

Assignment operator.

void setPattern ( const String pattern,
bool  caseInsensitive = false 
) throw (ParseException)

Set the regular expression pattern.

Parameters:
pattern The pattern.
caseInsensitive A flag indicating whether pattern matches using this pattern should be case-insensitive.
Exceptions:
ParseException If the pattern is invalid.
void setPattern ( const char *  pattern,
bool  caseInsensitive = false 
) throw (ParseException)

Set the regular expression pattern.

Parameters:
pattern The pattern.
caseInsensitive A flag indicating whether pattern matches using this pattern should be case-insensitive.
Exceptions:
ParseException If the pattern is invalid.
String toString (  )  const [inline]

Get a String representation of the RegExp.

Equivalent to getPattern().


Member Data Documentation

size_t re_erroffset
size_t re_nsub
void* re_pcre

The documentation for this class was generated from the following files:
Generated on Sat Nov 26 16:49:09 2011 for libcommonc++ by  doxygen 1.6.3