public static class ObText.ContentMatcher
extends regexodus.Matcher
| Constructor and Description |
|---|
ContentMatcher()
Constructs a ContentMatcher that will need to have its target set with
setTarget(CharSequence) or
one of its overloads. |
ContentMatcher(java.lang.CharSequence text)
Constructs a ContentMatcher that already has its target set to
text. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getMatch()
Returns the contents of the latest String successfully found with
Matcher.find(), without quotation. |
boolean |
hasMatch()
Returns true if
Matcher.find() has returned true and the found text is a usable String (not some syntax). |
void |
setTarget(char[] text,
int start,
int len)
Supplies a text to search in/match with, as a part of char array.
|
void |
setTarget(java.lang.CharSequence text)
Supplies a text to search in/match with.
|
void |
setTarget(java.lang.CharSequence text,
int start,
int len)
Supplies a text to search in/match with, as a part of String.
|
charAt, charAt, copy, dataEnd, dataStart, end, end, end, equals, find, find, findAll, findAll, flush, foundStrings, getGroup, getGroup, getGroup, getGroup, getGroup, getGroup, getGroup, getGroup, getString, group, group, group, groupCount, groups, groupv, hashCode, isCaptured, isCaptured, isCaptured, isStart, length, length, matches, matches, matchesPrefix, pattern, prefix, proceed, proceed, replaceAll, replaceAll, replaceAmount, replaceAmount, replaceFirst, replaceFirst, search, setAll, setPattern, setPosition, setTarget, setTarget, setTarget, skip, start, start, start, suffix, target, targetChars, targetEnd, targetStart, toStringpublic ContentMatcher()
setTarget(CharSequence) or
one of its overloads. The target should contain multiple substrings that may have quotation around them; this
class is meant to skip the quotation in ObText's style.public ContentMatcher(java.lang.CharSequence text)
text.text - the CharSequence, such as a String, to find possibly-quoted Strings in.public void setTarget(java.lang.CharSequence text)
setTarget in class regexodus.Matchertext - - a dataMatcher.setTarget(Matcher, int),
Matcher.setTarget(CharSequence, int, int),
Matcher.setTarget(char[], int, int),
Matcher.setTarget(Reader, int)public void setTarget(java.lang.CharSequence text,
int start,
int len)
setTarget in class regexodus.Matchertext - - a data sourcestart - - where the target startslen - - how long is the targetMatcher.setTarget(Matcher, int),
Matcher.setTarget(CharSequence),
Matcher.setTarget(char[], int, int),
Matcher.setTarget(Reader, int)public void setTarget(char[] text,
int start,
int len)
setTarget in class regexodus.Matchertext - - a data sourcestart - - where the target startslen - - how long is the targetMatcher.setTarget(Matcher, int),
Matcher.setTarget(CharSequence),
Matcher.setTarget(CharSequence, int, int),
Matcher.setTarget(Reader, int)public boolean hasMatch()
Matcher.find() has returned true and the found text is a usable String (not some syntax).
If this returns true, you can reasonably get a (possibly empty) String using getMatch().getMatch()public java.lang.String getMatch()
Matcher.find(), without quotation.
You should typically call hasMatch() even if find() has returned true, to ensure there is a valid
String that can be acquired (this will return an empty String if hasMatch() returns false, but an empty
String is also potentially a valid result in a successful match, so it should be distinguished).Matcher.find()Copyright © Eben Howard 2012–2022. All rights reserved.