Package com.mckoi.database.regexbridge
Class JavaRegex
java.lang.Object
com.mckoi.database.regexbridge.JavaRegex
- All Implemented Interfaces:
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
regexMatch
(String regular_expression, String expression_ops, String value) Matches a regular expression against a string value.regexSearch
(Table table, int column, String regular_expression, String expression_ops) Performs a regular expression search on the given column of the table.
-
Constructor Details
-
JavaRegex
public JavaRegex()
-
-
Method Details
-
regexMatch
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 interfaceRegexLibrary
- 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, String regular_expression, 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 interfaceRegexLibrary
- 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.
-