Class ObText.ContentMatcher
java.lang.Object
regexodus.Matcher
com.github.yellowstonegames.old.v300.ObText.ContentMatcher
- All Implemented Interfaces:
Serializable, regexodus.between.MatchResult, regexodus.MatchResult
- Enclosing class:
ObText
public static class ObText.ContentMatcher
extends regexodus.Matcher
- See Also:
-
Field Summary
Fields inherited from class regexodus.Matcher
ACCEPT_INCOMPLETE, ANCHOR_END, ANCHOR_LASTMATCH, ANCHOR_STARTFields inherited from interface regexodus.MatchResult
MATCH, PREFIX, SUFFIX, TARGET -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a ContentMatcher that will need to have its target set withsetTarget(CharSequence)or one of its overloads.ContentMatcher(CharSequence text) Constructs a ContentMatcher that already has its target set totext. -
Method Summary
Modifier and TypeMethodDescriptiongetMatch()Returns the contents of the latest String successfully found withMatcher.find(), without quotation.booleanhasMatch()Returns true ifMatcher.find()has returned true and the found text is a usable String (not some syntax).voidsetTarget(char[] text, int start, int len) Supplies a text to search in/match with, as a part of char array.voidsetTarget(CharSequence text) Supplies a text to search in/match with.voidsetTarget(CharSequence text, int start, int len) Supplies a text to search in/match with, as a part of String.Methods inherited from class regexodus.Matcher
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, toString
-
Constructor Details
-
ContentMatcher
public ContentMatcher()Constructs a ContentMatcher that will need to have its target set withsetTarget(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. -
ContentMatcher
Constructs a ContentMatcher that already has its target set totext.- Parameters:
text- the CharSequence, such as a String, to find possibly-quoted Strings in.
-
-
Method Details
-
setTarget
Supplies a text to search in/match with. Resets current search position to zero.- Overrides:
setTargetin classregexodus.Matcher- Parameters:
text- - a data- See Also:
-
setTarget
Supplies a text to search in/match with, as a part of String. Resets current search position to zero.- Overrides:
setTargetin classregexodus.Matcher- Parameters:
text- - a data sourcestart- - where the target startslen- - how long is the target- See Also:
-
setTarget
public void setTarget(char[] text, int start, int len) Supplies a text to search in/match with, as a part of char array. Resets current search position to zero.- Overrides:
setTargetin classregexodus.Matcher- Parameters:
text- - a data sourcestart- - where the target startslen- - how long is the target- See Also:
-
hasMatch
public boolean hasMatch()Returns true ifMatcher.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 usinggetMatch().- Returns:
- true if there is a usable String found that can be obtained with
getMatch()
-
getMatch
Returns the contents of the latest String successfully found withMatcher.find(), without quotation. You should typically callhasMatch()even iffind()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.- Returns:
- the contents of the latest String successfully found with
Matcher.find()
-