public class PatternSearchMatcher extends SearchMatcher
Pattern
SearchMatcher.Match
noWordSep, returnValue, wholeWord
Constructor and Description |
---|
PatternSearchMatcher(java.util.regex.Pattern re,
boolean ignoreCase)
Creates a new regular expression already compiled.
|
PatternSearchMatcher(java.util.regex.Pattern re,
boolean ignoreCase,
boolean wholeWord)
Creates a new regular expression string matcher.
|
PatternSearchMatcher(java.lang.String search,
boolean ignoreCase)
Creates a new regular expression string matcher.
|
Modifier and Type | Method and Description |
---|---|
SearchMatcher.Match |
nextMatch(java.lang.CharSequence text,
boolean start,
boolean end,
boolean firstTime,
boolean reverse)
Returns the offset of the first match of the specified text
within this matcher.
|
static java.util.regex.Pattern |
removeNonCapturingGroups(java.util.regex.Pattern re,
int flags) |
java.lang.String |
toString() |
isWholeWord, setNoWordSep
public PatternSearchMatcher(java.lang.String search, boolean ignoreCase)
search
- the search patternignoreCase
- true
if you want to ignore casePattern
public PatternSearchMatcher(java.util.regex.Pattern re, boolean ignoreCase, boolean wholeWord)
re
- the compiled regexignoreCase
- true
if you want to ignore casewholeWord
- true
to search for whole word onlyPattern
public PatternSearchMatcher(java.util.regex.Pattern re, boolean ignoreCase)
re
- the compiled regexignoreCase
- true
if you want to ignore casePattern
public SearchMatcher.Match nextMatch(java.lang.CharSequence text, boolean start, boolean end, boolean firstTime, boolean reverse)
Reverse regex search is done by searching from the beginning to just prior to the current match, so will be inefficient for large buffers.
nextMatch
in class SearchMatcher
text
- The text to search instart
- True if the start of the text is the beginning of a lineend
- True if the end of the text is the end of a linefirstTime
- If false and the search string matched at the start
offset with length zero, automatically find next matchreverse
- If true, searching will be performed in a backward
direction.SearchMatcher.Match
object.public static java.util.regex.Pattern removeNonCapturingGroups(java.util.regex.Pattern re, int flags)
public java.lang.String toString()
toString
in class java.lang.Object