com.mckoi.database.regexbridge
Class JavaRegex

java.lang.Object
  extended by com.mckoi.database.regexbridge.JavaRegex
All Implemented Interfaces:
RegexLibrary

public class JavaRegex
extends java.lang.Object
implements RegexLibrary

A bridge to the internal Java regular expression library that was introduced in Java 1.4. This bridge will only work if the regular expression API is available in the class library. It is not available in 1.3 and 1.2.

Author:
Tobias Downer

Constructor Summary
JavaRegex()
           
 
Method Summary
 boolean regexMatch(java.lang.String regular_expression, java.lang.String expression_ops, java.lang.String value)
          Matches a regular expression against a string value.
 IntegerVector regexSearch(Table table, int column, java.lang.String regular_expression, java.lang.String expression_ops)
          Performs a regular expression search on the given column of the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaRegex

public JavaRegex()
Method Detail

regexMatch

public boolean regexMatch(java.lang.String regular_expression,
                          java.lang.String expression_ops,
                          java.lang.String value)
Description copied from interface: RegexLibrary
Matches a regular expression against a string value. If the value is a match against the expression then it returns true.

Specified by:
regexMatch in interface RegexLibrary
Parameters:
regular_expression - the expression to match (eg. "[0-9]+").
expression_ops - expression operator string that specifies various flags. For example, "im" is like '/[expression]/im' in Perl.
value - the string to test.

regexSearch

public IntegerVector regexSearch(Table table,
                                 int column,
                                 java.lang.String regular_expression,
                                 java.lang.String expression_ops)
Description copied from interface: RegexLibrary
Performs a regular expression search on the given column of the table. Returns an IntegerVector that contains the list of rows in the table that matched the expression. Returns an empty list if the expression matched no rows in the column.

Specified by:
regexSearch in interface RegexLibrary
Parameters:
table - the table to search for matching values.
column - the column of the table to search for matching values.
regular_expression - the expression to match (eg. "[0-9]+").
expression_ops - expression operator string that specifies various flags. For example, "im" is like '/[expression]/im' in Perl.