public class RegexSearcher extends AbstractSearcher
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_EXACT |
static int |
TYPE_KEYWORD |
static int |
TYPE_WHOLE_TERM |
mReplaceSpCh
Constructor and Description |
---|
RegexSearcher(java.util.regex.Pattern pattern)
Creates a new instance of RegexSearcher.
|
RegexSearcher(java.lang.String regex,
boolean caseSensitive)
Creates a new instance of RegexSearcher.
|
RegexSearcher(java.lang.String regex,
boolean caseSensitive,
java.lang.String searchTerm)
Creates a new instance of RegexSearcher.
|
Modifier and Type | Method and Description |
---|---|
static java.util.regex.Pattern |
createSearchPattern(java.lang.String regex,
boolean caseSensitive)
Creates a pattern for a regular expression.
|
java.util.regex.Pattern |
getPattern()
get the pattern used by this searcher
|
protected boolean |
matches(java.lang.String value)
Checks whether a value matches to the criteria of this searcher.
|
static java.lang.String |
searchTextToRegex(java.lang.String searchText,
int type)
Creates a regex from a search text.
|
matches, search, search, search
public static final int TYPE_EXACT
public static final int TYPE_KEYWORD
public static final int TYPE_WHOLE_TERM
public RegexSearcher(java.util.regex.Pattern pattern)
pattern
- The regex pattern to use.public RegexSearcher(java.lang.String regex, boolean caseSensitive) throws TvBrowserException
regex
- caseSensitive
- TvBrowserException
- If there is a syntax error in the regular expression.public RegexSearcher(java.lang.String regex, boolean caseSensitive, java.lang.String searchTerm) throws TvBrowserException
regex
- caseSensitive
- TvBrowserException
- If there is a syntax error in the regular expression.public static java.util.regex.Pattern createSearchPattern(java.lang.String regex, boolean caseSensitive) throws TvBrowserException
regex
- The regular expressioncaseSensitive
- Should the search be case sensitive?TvBrowserException
- If there is a syntax error in the regular expression.public static java.lang.String searchTextToRegex(java.lang.String searchText, int type)
All regex code in the search text will be quoted. The returned regex will ignore differences in whitespace.
searchText
- The search text to create a regex for.type
- Value from:
TYPE_EXACT
To match only the exact regex.
TYPE_KEYWORD
To match a keyword (= substring).
TYPE_WHOLE_TERM
To match a whole term.protected boolean matches(java.lang.String value)
matches
in class AbstractSearcher
value
- The value to checkpublic java.util.regex.Pattern getPattern()
TV-Browser 3.4.4, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)