csRegExpMatcher Class Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
csRegExpMatcher Class Reference

Matcher for regular expressions. More...

`#include <csutil/regexp.h>`

Inheritance diagram for csRegExpMatcher:

List of all members.

## Public Member Functions
| csRegExpMatcher (const char *pattern, bool extendedRE=false)
| Create a new RE matcher.
| csRegExpMatcher (const csRegExpMatcher &other)
| Copy constructor.
csRegExpMatchError | Match (const char *string, int flags=0)
| Match a string against the pattern.
csRegExpMatchError | Match (const char *string, csArray< csRegExpMatch > &matches, int flags=0)
| Match a string against the pattern.
csRegExpMatcher & | operator= (const csRegExpMatcher &other)
| Assignment operator.
| ~csRegExpMatcher ()
| Destructor.

## Detailed Description

Matcher for regular expressions.

Note:
  Implementation note: if the platform supports it, this class wraps the runtime libraries POSIX.2 regular expression interface; otherwise, it uses a built-in implementation of POSIX.2 regular expression (borrowed from glibc.) Both of them utiltize "compilation" of pattern for faster repeated matching of the same pattern. Although compilation is transparent, you should be aware that calls to Match() with different flags than previous calls cause a recompilation of the pattern. Thus, to improve performance, same `flags` should be used for subsequent calls to Match().

Definition at line 169 of file regexp.h.

## Constructor & Destructor Documentation

csRegExpMatcher::csRegExpMatcher | ( | const char * | pattern,
|  | bool | extendedRE = `false`
| ) |  |

Create a new RE matcher.

Parameters:

  pattern | Pattern to match against.
  extendedRE | Treat the pattern as an extended regular expression, rather than as a basic regular expression.

csRegExpMatcher::csRegExpMatcher | ( | const csRegExpMatcher & | other | ) |

Copy constructor.

csRegExpMatcher::~csRegExpMatcher | ( |  | ) |

Destructor.

## Member Function Documentation

csRegExpMatchError csRegExpMatcher::Match | ( | const char * | string,
|  | int | flags = `0`
| ) |  |

Match a string against the pattern.

Parameters:

  string | String against which to attempt match.
  flags | One or more of csRegExpMatchFlags. Flags are combined using the bitwise-or ``| operator.

Returns:
  csrxNoError in case of success, else an error code.

Note:
  Also check the "Implementation note" in the csRegExpMatcher description.

csRegExpMatchError csRegExpMatcher::Match | ( | const char * | string,
|  | csArray< csRegExpMatch > & | matches,
|  | int | flags = `0`
| ) |  |

Match a string against the pattern.

Parameters:

  string | String against which to attempt match.
  matches | Array receiving the locations of individual (sub)expression matches.
  flags | One or more of csRegExpMatchFlags. Flags are combined using the bitwise-or ``| operator.

Returns:
  csrxNoError in case of success, else an error code.

Note:
  Also check the "Implementation note" in the csRegExpMatcher description.

csRegExpMatcher& csRegExpMatcher::operator= | ( | const csRegExpMatcher & | other | ) |

Assignment operator.

The documentation for this class was generated from the following file:

- csutil/regexp.h