Class RegexMatcher.Simple
java.lang.Object
com.samsthenerd.inline.api.matching.RegexMatcher.Simple
- All Implemented Interfaces:
ContinuousMatcher
,InlineMatcher
,RegexMatcher
- Enclosing interface:
- RegexMatcher
A helper class for constructing a RegexMatcher from just a
regex pattern and a getMatch function.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.samsthenerd.inline.api.matching.ContinuousMatcher
ContinuousMatcher.ContinuousMatchResult
Nested classes/interfaces inherited from interface com.samsthenerd.inline.api.matching.RegexMatcher
RegexMatcher.ChatStandard, RegexMatcher.Simple, RegexMatcher.Standard
-
Constructor Summary
ConstructorsConstructorDescriptionSimple
(String regex, net.minecraft.util.Identifier id, Function<MatchResult, InlineMatch> matcher, MatcherInfo info) Simple
(Pattern regex, net.minecraft.util.Identifier id, Function<MatchResult, InlineMatch> matcher, MatcherInfo info) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.util.Identifier
getId()
Get the ID for this matchergetInfo()
Get info about this matcher.getMatch
(MatchResult regexMatch, MatchContext matchContext) Parses an InlineMatch out of the regexMatch.getRegex()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.samsthenerd.inline.api.matching.ContinuousMatcher
match
Methods inherited from interface com.samsthenerd.inline.api.matching.RegexMatcher
getMatchAndGroup, match
-
Constructor Details
-
Simple
public Simple(Pattern regex, net.minecraft.util.Identifier id, Function<MatchResult, InlineMatch> matcher, MatcherInfo info) -
Simple
public Simple(String regex, net.minecraft.util.Identifier id, Function<MatchResult, InlineMatch> matcher, MatcherInfo info)
-
-
Method Details
-
getRegex
- Specified by:
getRegex
in interfaceRegexMatcher
-
getMatch
Description copied from interface:RegexMatcher
Parses an InlineMatch out of the regexMatch.- Specified by:
getMatch
in interfaceRegexMatcher
- Parameters:
regexMatch
- a single match from the provided regex.matchContext
- a match context provided in-case it's needed. It generally won't be.- Returns:
- InlineMatch that gets attached to the entire regex match or null for no match
-
getInfo
Description copied from interface:InlineMatcher
Get info about this matcher.- Specified by:
getInfo
in interfaceInlineMatcher
- Returns:
- matcher's info.
-
getId
public net.minecraft.util.Identifier getId()Description copied from interface:InlineMatcher
Get the ID for this matcher- Specified by:
getId
in interfaceInlineMatcher
- Returns:
- matcher's ID
-