net.percederberg.grammatica.parser.re
Class RegExp

java.lang.Object
  extended by net.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 case-sensitive regular expression.
RegExp(java.lang.String pattern, boolean ignoreCase)
          Creates a new regular expression.
 
Method Summary
 Matcher matcher(CharBuffer str)
          Deprecated. The CharBuffer class has been deprecated in favor of ReaderBuffer as of version 1.5. Create a ReaderBuffer and use the matcher(ReaderBuffer) method instead of this one.
 Matcher matcher(ReaderBuffer buffer)
          Creates a new matcher for the specified look-ahead character input stream.
 Matcher matcher(java.lang.String 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 case-sensitive regular expression.

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

RegExp

public RegExp(java.lang.String pattern,
              boolean ignoreCase)
       throws RegExpException
Creates a new regular expression. The regular expression can be either case-sensitive or case-insensitive.

Parameters:
pattern - the regular expression pattern
ignoreCase - the character case ignore flag
Throws:
RegExpException - if the regular expression couldn't be parsed correctly
Since:
1.5
Method Detail

matcher

public Matcher matcher(CharBuffer str)
Deprecated. The CharBuffer class has been deprecated in favor of ReaderBuffer as of version 1.5. Create a ReaderBuffer and use the matcher(ReaderBuffer) method instead of this one.

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 expression matcher

matcher

public Matcher matcher(ReaderBuffer buffer)
Creates a new matcher for the specified look-ahead character input stream.

Parameters:
buffer - the character input buffer
Returns:
the regular expression matcher
Since:
1.5

toString

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

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the regular expression