|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.regex.Matcher
public final class Matcher
Instance of a regular expression applied to a char sequence.
| Method Summary | |
|---|---|
Matcher |
appendReplacement(StringBuffer sb,
String replacement)
|
StringBuffer |
appendTail(StringBuffer sb)
|
int |
end()
Returns the index just after the last matched character. |
int |
end(int group)
Returns the index just after the last matched character of the given sub-match group. |
boolean |
find()
|
boolean |
find(int start)
|
String |
group()
Returns the substring of the input which was matched. |
String |
group(int group)
Returns the substring of the input which was matched by the given sub-match group. |
int |
groupCount()
Returns the number of sub-match groups in the matching pattern. |
boolean |
hitEnd()
|
boolean |
lookingAt()
|
boolean |
matches()
Attempts to match the entire input sequence against the pattern. |
Pattern |
pattern()
Returns the Pattern that is interpreted by this Matcher |
String |
replaceAll(String replacement)
|
String |
replaceFirst(String replacement)
|
Matcher |
reset()
|
Matcher |
reset(CharSequence input)
|
int |
start()
Returns the index of the first character of the match. |
int |
start(int group)
Returns the index of the first character of the given sub-match group. |
String |
toString()
Convert this Object to a human-readable String. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public Matcher appendReplacement(StringBuffer sb,
String replacement)
throws IllegalStateException
sb - The target string bufferreplacement - The replacement string
IllegalStateException - If no match has yet been attempted,
or if the previous match operation failed
IndexOutOfBoundsException - If the replacement string refers
to a capturing group that does not exist in the patternpublic StringBuffer appendTail(StringBuffer sb)
sb - The target string buffer
public int end()
throws IllegalStateException
MatchResult
end in interface MatchResultIllegalStateException - If no match has yet been attempted,
or if the previous match operation failed
public int end(int group)
throws IllegalStateException
MatchResult
end in interface MatchResultgroup - The index of a capturing group in this matcher's pattern
IllegalStateException - If no match has yet been attempted,
or if the previous match operation failed
IndexOutOfBoundsException - If the replacement string refers
to a capturing group that does not exist in the patternpublic boolean find()
public boolean find(int start)
start - The index to start the new pattern matching
IndexOutOfBoundsException - If the replacement string refers
to a capturing group that does not exist in the patternpublic String group()
MatchResult
group in interface MatchResultIllegalStateException - If no match has yet been attempted,
or if the previous match operation failed
public String group(int group)
throws IllegalStateException
MatchResult
group in interface MatchResultgroup - The index of a capturing group in this matcher's pattern
IllegalStateException - If no match has yet been attempted,
or if the previous match operation failed
IndexOutOfBoundsException - If the replacement string refers
to a capturing group that does not exist in the patternpublic String replaceFirst(String replacement)
replacement - The replacement stringpublic String replaceAll(String replacement)
replacement - The replacement stringpublic int groupCount()
MatchResult
groupCount in interface MatchResultpublic boolean lookingAt()
public boolean matches()
start(),
end(),
group()public Pattern pattern()
public Matcher reset()
public Matcher reset(CharSequence input)
input - The new input character sequence
public int start()
throws IllegalStateException
MatchResult
start in interface MatchResultIllegalStateException - If no match has yet been attempted,
or if the previous match operation failed
public int start(int group)
throws IllegalStateException
MatchResult
start in interface MatchResultgroup - The index of a capturing group in this matcher's pattern
IllegalStateException - If no match has yet been attempted,
or if the previous match operation failed
IndexOutOfBoundsException - If the replacement string refers
to a capturing group that does not exist in the patternpublic boolean hitEnd()
public String toString()
ObjectSystem.out.println()
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a RuntimeException.
This method will be called when performing string
concatenation with this object. If the result is
null, string concatenation will instead
use "null".
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode()).
toString in class ObjectObject.getClass(),
Object.hashCode(),
Class.getName(),
Integer.toHexString(int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||