public class Matcher
extends java.lang.Object
Constructor and Description |
---|
Matcher(javax.swing.text.Document document,
java.lang.String findString)
Creates a new instance of Matcher which
performs a case sensitive search.
|
Matcher(javax.swing.text.Document document,
java.lang.String findString,
boolean matchCase,
MatchType matchType)
Creates a new instance of Matcher
|
Modifier and Type | Method and Description |
---|---|
int |
findNext()
Attempts to find the next subsequence of the
input sequence that matches the pattern.
|
int |
findNext(int startIndex)
Resets this matcher and then attempts to find the next
subsequence of the input sequence that matches the pattern,
starting at the specified index.
|
int |
findPrevious()
Attempts to find the previous subsequence of the
input sequence that matches the pattern.
|
int |
findPrevious(int startIndex)
Resets this matcher and then attempts to find the previous
subsequence of the input sequence that matches the pattern,
starting at the specified index.
|
java.lang.String |
getFindString() |
MatchType |
getMatchType() |
boolean |
isMatchCase() |
void |
reset()
Resets the startIndex of the matcher to 0.
|
void |
setStartIndex(int newValue)
Sets the start index for the findNext(), findPrevious() methods.
|
public Matcher(javax.swing.text.Document document, java.lang.String findString)
document
- The document to be examinedfindString
- The string to be searched.public Matcher(javax.swing.text.Document document, java.lang.String findString, boolean matchCase, MatchType matchType)
document
- The document to be examinedfindString
- The string to be searched.matchCase
- Set to true for case sensitive search.matchType
- Sets the match type.public java.lang.String getFindString()
public boolean isMatchCase()
public MatchType getMatchType()
public void setStartIndex(int newValue)
public int findNext(int startIndex)
startIndex
- the index from which to start the search.public int findNext()
This method starts at the beginning of the input sequence or, if a previous invocation of the method was successful and the matcher has not since been reset, at the first character not matched by the previous match.
public int findPrevious(int startIndex)
startIndex
- the index from which to start the search.public int findPrevious()
This method starts at the beginning of the input sequence or, if a previous invocation of the method was successful and the matcher has not since been reset, at the first character not matched by the previous match.
public void reset()