public class RegexFilter extends RegexMatcher implements Filter<java.util.regex.Matcher>
By default, Tuples that match the given pattern are kept, and Tuples that do not match are filtered out. This can be changed by setting removeMatch to true.
Also, by default, the whole Tuple is matched against the given patternString (tab delimited, unless otherwise specified). If matchEachElement is set to true, the pattern is applied to each Tuple value individually.
This operation uses Matcher
internally, specifically the method
Matcher.find()
.
Note a null
valued argument passed to the parser will be converted to an empty string (""
) before
the regex is applied.
Any Object value will be coerced to a String type via any provided CoercibleType
on
the argument selector or via its toString()
method.
Matcher
,
Pattern
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected boolean |
matchEachElement
Field matchEachElement
|
DEFAULT_DELIM, delimiter, negateMatch
patternString
fieldDeclaration, numArgs, trace
Constructor and Description |
---|
RegexFilter(java.lang.String patternString)
Constructor RegexFilter creates a new RegexFilter instance.
|
RegexFilter(java.lang.String patternString,
boolean removeMatch)
Constructor RegexFilter creates a new RegexFilter instance.
|
RegexFilter(java.lang.String patternString,
boolean removeMatch,
boolean matchEachElement) |
RegexFilter(java.lang.String patternString,
boolean removeMatch,
boolean matchEachElement,
java.lang.String delimiter) |
RegexFilter(java.lang.String patternString,
boolean removeMatch,
java.lang.String delimiter)
Constructor RegexFilter creates a new RegexFilter instance.
|
RegexFilter(java.lang.String patternString,
java.lang.String delimiter)
Constructor RegexFilter creates a new RegexFilter instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object) |
int |
hashCode() |
boolean |
isMatchEachElement() |
boolean |
isRemove(FlowProcess flowProcess,
FilterCall<java.util.regex.Matcher> filterCall)
Method isRemove returns true if input should be removed from the tuple stream.
|
getDelimiter, isNegateMatch, matchEachElement, matchEachElementPos, matchWholeTuple, prepare
getPattern, getPatternString
cleanup, flush, getFieldDeclaration, getNumArgs, getTrace, isSafe, printOperationInternal, toString, toStringInternal
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
cleanup, flush, getFieldDeclaration, getNumArgs, isSafe, prepare
protected final boolean matchEachElement
@ConstructorProperties(value="patternString") public RegexFilter(java.lang.String patternString)
patternString
- of type String@ConstructorProperties(value={"patternString","delimiter"}) public RegexFilter(java.lang.String patternString, java.lang.String delimiter)
patternString
- of type Stringdelimiter
- of type String@ConstructorProperties(value={"patternString","removeMatch"}) public RegexFilter(java.lang.String patternString, boolean removeMatch)
patternString
- of type StringremoveMatch
- of type boolean@ConstructorProperties(value={"patternString","removeMatch","delimiter"}) public RegexFilter(java.lang.String patternString, boolean removeMatch, java.lang.String delimiter)
patternString
- of type StringremoveMatch
- of type booleandelimiter
- of type String@ConstructorProperties(value={"patternString","removeMatch","matchEachElement"}) public RegexFilter(java.lang.String patternString, boolean removeMatch, boolean matchEachElement)
patternString
- of type StringremoveMatch
- of type boolean, set to true if a match should be filteredmatchEachElement
- of type boolean, set to true if each element should be matched individually@ConstructorProperties(value={"patternString","removeMatch","matchEachElement","delimiter"}) public RegexFilter(java.lang.String patternString, boolean removeMatch, boolean matchEachElement, java.lang.String delimiter)
patternString
- of type StringremoveMatch
- of type boolean, set to true if a match should be filteredmatchEachElement
- of type boolean, set to true if each element should be matched individuallydelimiter
- of type Stringpublic boolean isMatchEachElement()
public boolean isRemove(FlowProcess flowProcess, FilterCall<java.util.regex.Matcher> filterCall)
Filter
public boolean equals(java.lang.Object object)
equals
in class RegexMatcher
public int hashCode()
hashCode
in class RegexMatcher
Copyright © 2007-2017 Cascading Maintainers. All Rights Reserved.