de.dfki.lt.tools.tokenizer.regexp
Class JavaRegExp

java.lang.Object
  extended byde.dfki.lt.tools.tokenizer.regexp.JavaRegExp
All Implemented Interfaces:
RegExp

public class JavaRegExp
extends java.lang.Object
implements RegExp

JavaRegExp implements the RegExp interface for regular expressions of the java.util.regex package.

Version:
$Id: JavaRegExp.java,v 1.4 2005/04/12 08:47:37 steffen Exp $
Author:
Joerg Steffen

Constructor Summary
JavaRegExp(java.lang.String regExpString)
          This creates a new instance of JavaRegExp for a String containing a regular expression.
 
Method Summary
 Match contains(java.lang.String input)
          This checks if the input contains a match for the regular expression.
 java.util.List getAllMatches(java.lang.String input)
          This returns an array of all Matches for the regular expression in input.
 boolean matches(java.lang.String input)
          This checks if the regular expression matches the input in its entirety.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaRegExp

public JavaRegExp(java.lang.String regExpString)
           throws InitializationException
This creates a new instance of JavaRegExp for a String containing a regular expression.

Parameters:
regExpString - a String with a regular expression
Throws:
InitializationException - if regular expression is not well formed
Method Detail

getAllMatches

public java.util.List getAllMatches(java.lang.String input)
This returns an array of all Matches for the regular expression in input.

Specified by:
getAllMatches in interface RegExp
Parameters:
input - the String where to look for matches
Returns:
a List of Matches

matches

public boolean matches(java.lang.String input)
This checks if the regular expression matches the input in its entirety.

Specified by:
matches in interface RegExp
Parameters:
input - the String to check
Returns:
a boolean

contains

public Match contains(java.lang.String input)
This checks if the input contains a match for the regular expression. If yes, a Match is returned, null otherwise.

Specified by:
contains in interface RegExp
Parameters:
input - the String to check
Returns:
a Match or null