Class RegularExpression<E>
java.lang.Object
edu.washington.cs.knowitall.regex.RegularExpression<E>
- Type Parameters:
E- the type of the sequence elements
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanApply the expression against a list of tokens.static <E> FiniteAutomaton.Automaton<E> build(List<Expression<E>> exprs) Build an NFA from the list of expressions.static <E> RegularExpression<E> compile(String expression, com.google.common.base.Function<String, Expression.BaseExpression<E>> factoryDelegate) Create a regular expression from the specified string.static <E> RegularExpression<E> compile(List<Expression<E>> expressions) Create a regular expression without tokenization support.booleanFind the first match of the regular expression against tokens.Find the first match of the regular expression against tokens, starting at the specified index.Find all non-overlapping matches of the regular expression against tokens.inthashCode()Determine if the regular expression matches the beginning of the supplied tokens.Determine if the regular expression matches the supplied tokens, starting at the specified index.static voidAn interactive program that compiles a word-based regular expression specified in arg1 and then reads strings from stdin, evaluating them against the regular expression.booleanApply the expression against a list of tokens.toString()Methods inherited from interface com.google.common.base.Predicate
test
-
Field Details
-
expressions
-
auto
-
-
Constructor Details
-
RegularExpression
-
-
Method Details
-
compile
Create a regular expression without tokenization support.- Parameters:
expressions-- Returns:
-
compile
public static <E> RegularExpression<E> compile(String expression, com.google.common.base.Function<String, Expression.BaseExpression<E>> factoryDelegate) Create a regular expression from the specified string.- Parameters:
expression-factoryDelegate-- Returns:
-
equals
-
hashCode
-
toString
-
build
Build an NFA from the list of expressions.- Parameters:
exprs-- Returns:
-
apply
-
matches
-
find
Find the first match of the regular expression against tokens. This method is slightly slower due to additional memory allocations. However, the response has much greater detail and is very useful for writing/debugging regular expressions.- Parameters:
tokens-- Returns:
- an object representing the match, or null if no match is found.
-
find
Find the first match of the regular expression against tokens, starting at the specified index.- Parameters:
tokens- tokens to match against.start- index to start looking for a match.- Returns:
- an object representing the match, or null if no match is found.
-
lookingAt
-
lookingAt
Determine if the regular expression matches the supplied tokens, starting at the specified index.- Parameters:
tokens- the list of tokens to match.start- the index where the match should begin.- Returns:
- an object representing the match, or null if no match is found.
-
match
-
findAll
-
main
An interactive program that compiles a word-based regular expression specified in arg1 and then reads strings from stdin, evaluating them against the regular expression.- Parameters:
args-
-