net.percederberg.grammatica.parser.re
Class RegExp

java.lang.Object
  extended bynet.percederberg.grammatica.parser.re.RegExp

public class RegExp
extends java.lang.Object

A regular expression. This class creates and holds an internal data structure representing a regular expression. It also allows creating matchers. This class is thread-safe. Multiple matchers may operate simultanously on the same regular expression.


Constructor Summary
RegExp(java.lang.String pattern)
          Creates a new regular expression.
 
Method Summary
 Matcher matcher(CharBuffer str)
          Creates a new matcher for the specified string.
 Matcher matcher(java.lang.String str)
          Creates a new matcher for the specified string.
 Matcher matcher(java.lang.StringBuffer str)
          Creates a new matcher for the specified string.
 java.lang.String toString()
          Returns a string representation of the regular expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RegExp

public RegExp(java.lang.String pattern)
       throws RegExpException
Creates a new regular expression.

Parameters:
pattern - the regular expression pattern
Throws:
RegExpException - if the regular expression couldn't be parsed correctly
Method Detail

matcher

public Matcher matcher(CharBuffer str)
Creates a new matcher for the specified string.

Parameters:
str - the string to work with
Returns:
the regular expresion matcher

matcher

public Matcher matcher(java.lang.String str)
Creates a new matcher for the specified string.

Parameters:
str - the string to work with
Returns:
the regular expresion matcher

matcher

public Matcher matcher(java.lang.StringBuffer str)
Creates a new matcher for the specified string.

Parameters:
str - the string to work with
Returns:
the regular expresion matcher

toString

public java.lang.String toString()
Returns a string representation of the regular expression.

Returns:
a string representation of the regular expression