java.lang.Object
xyz.ronella.trivial.handy.RegExMatcher
A handy class to find a RegEx pattern from a text.
- Since:
- 2.5.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic MatcherFind the RegEx from a text.static MatcherFind the RegEx from a text with pattern flags.static MatcherA convenience method for the find matching with pattern flags.static Matcherfind(String pattern, String text, int flags, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic) A convenience method for the find matching with pattern flags.static MatcherA convenience method for the find matching.static Matcherfind(String pattern, String text, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic) A convenience method for the find matching.static MatcherfindWithMatchLogic(String pattern, String text, Consumer<Matcher> matchFoundLogic) Deprecated.Use match(String, String, IRegExMatcherConfig) instead.static MatcherfindWithMatchLogic(String pattern, String text, Consumer<Matcher> matchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use match(String, String, IRegExMatcherConfig) instead.static MatcherfindWithNoMatchLogic(String pattern, String text, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic) Deprecated.Use match(String, String, IRegExMatcherConfig) instead.static MatcherfindWithNoMatchLogic(String pattern, String text, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use match(String, String, IRegExMatcherConfig) instead.static MatcherDeprecated.Use match(String, String, IRegExMatcherConfig) instead.static Matchermatch(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use match(String, String, Function, IRegExMatcherConfig) instead.static Matchermatch(String pattern, String text, IMatcherConfig config) static MatchermatchByRegEx(String pattern, String text) Deprecated.Use find instead.static MatchermatchByRegEx(String pattern, String text, Consumer<Matcher> matchFoundLogic) Deprecated.Use findWithMatchLogic instead.static MatchermatchByRegEx(String pattern, String text, Consumer<Matcher> matchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use findWithMatchLogic instead.static MatchermatchByRegEx(String pattern, String text, Consumer<Matcher> matchFoundLogic, Sink noMatchFoundLogic) Deprecated.Use findWithNoMatchLogic instead.static MatchermatchByRegEx(String pattern, String text, Consumer<Matcher> matchFoundLogic, Sink noMatchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use findWithNoMatchLogic instead.static MatcherDeprecated.Use match instead.static MatchermatchByRegEx(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic) Deprecated.Use matchWithMatchLogic instead.static MatchermatchByRegEx(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use matchWithMatchLogic instead.static MatchermatchByRegEx(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Sink noMatchFoundLogic) Deprecated.Use matchWithNoMatchLogic instead.static MatchermatchByRegEx(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Sink noMatchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use matchWithNoMatchLogic instead.static MatchermatchWithMatchLogic(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic) Deprecated.Use match(String, String, Function, IRegExMatcherConfig) instead.static MatchermatchWithMatchLogic(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use match(String, String, Function, IRegExMatcherConfig) instead.static MatchermatchWithNoMatchLogic(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic) Deprecated.Use match(String, String, Function, IRegExMatcherConfig) instead.static MatchermatchWithNoMatchLogic(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use match(String, String, Function, IRegExMatcherConfig) instead.
-
Method Details
-
match
- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.config- An implementation of IRegExMatcherConfig dictates how the match will behave.- Returns:
- An instance of Matcher.
- Since:
- 2.11.0
-
find
Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.- Returns:
- An instance of Matcher.
- Since:
- 2.6.0
-
find
Find the RegEx from a text with pattern flags.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.flags- The pattern flags to use.- Returns:
- An instance of Matcher.
- Since:
- 2.11.0
-
findWithMatchLogic
@Deprecated public static Matcher findWithMatchLogic(String pattern, String text, Consumer<Matcher> matchFoundLogic) Deprecated.Use match(String, String, IRegExMatcherConfig) instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchFoundLogic- The logic executed when the pattern was found.- Returns:
- An instance of Matcher.
- Since:
- 2.6.0
-
findWithMatchLogic
@Deprecated public static Matcher findWithMatchLogic(String pattern, String text, Consumer<Matcher> matchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use match(String, String, IRegExMatcherConfig) instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchFoundLogic- The logic executed when the pattern was found.exceptionLogic- The logic for capturing exception RuntimeException.- Returns:
- An instance of Matcher.
- Since:
- 2.6.0
-
findWithNoMatchLogic
@Deprecated public static Matcher findWithNoMatchLogic(String pattern, String text, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic) Deprecated.Use match(String, String, IRegExMatcherConfig) instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchFoundLogic- The logic executed when the pattern was found.noMatchFoundLogic- The logic executed when the pattern was not found.- Returns:
- An instance of Matcher.
- Since:
- 2.6.0
-
find
public static Matcher find(String pattern, String text, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic) A convenience method for the find matching.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchFoundLogic- The logic executed when the pattern was found.noMatchFoundLogic- The logic executed when the pattern was not found.- Returns:
- An instance of Matcher.
- Since:
- 2.11.0
-
find
A convenience method for the find matching.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchFoundLogic- The logic executed when the pattern was found.- Returns:
- An instance of Matcher.
- Since:
- 2.11.0
-
find
public static Matcher find(String pattern, String text, int flags, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic) A convenience method for the find matching with pattern flags.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.flags- The Pattern flags to use.matchFoundLogic- The logic executed when the pattern was found.noMatchFoundLogic- The logic executed when the pattern was not found.- Returns:
- An instance of Matcher.
- Since:
- 2.11.0
-
find
public static Matcher find(String pattern, String text, int flags, Consumer<Matcher> matchFoundLogic) A convenience method for the find matching with pattern flags.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.flags- The Pattern flags to use.matchFoundLogic- The logic executed when the pattern was found.- Returns:
- An instance of Matcher.
- Since:
- 2.11.0
-
findWithNoMatchLogic
@Deprecated public static Matcher findWithNoMatchLogic(String pattern, String text, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use match(String, String, IRegExMatcherConfig) instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchFoundLogic- The logic executed when the pattern was found.noMatchFoundLogic- The logic executed when the pattern was not found.exceptionLogic- The logic for capturing exception RuntimeException.- Returns:
- An instance of Matcher.
- Since:
- 2.6.0
-
match
@Deprecated public static Matcher match(String pattern, String text, Function<Matcher, Boolean> matchLogic) Deprecated.Use match(String, String, IRegExMatcherConfig) instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to match.text- The text where to find the pattern.matchLogic- The logic to be used for matching the regex.- Returns:
- An instance of Matcher.
- Since:
- 2.6.0
-
match
@Deprecated public static Matcher match(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use match(String, String, Function, IRegExMatcherConfig) instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to match.text- The text where to find the pattern.matchLogic- The logic to be used for matching the regex.exceptionLogic- The logic for capturing exception RuntimeException.- Returns:
- An instance of Matcher.
- Since:
- 2.6.0
-
matchWithMatchLogic
@Deprecated public static Matcher matchWithMatchLogic(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic) Deprecated.Use match(String, String, Function, IRegExMatcherConfig) instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to match.text- The text where to find the pattern.matchLogic- The logic to be used for matching the regex.matchFoundLogic- The logic executed when the pattern was found.- Returns:
- An instance of Matcher.
- Since:
- 2.6.0
-
matchWithMatchLogic
@Deprecated public static Matcher matchWithMatchLogic(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use match(String, String, Function, IRegExMatcherConfig) instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to match.text- The text where to find the pattern.matchLogic- The logic to be used for matching the regex.matchFoundLogic- The logic executed when the pattern was found.exceptionLogic- The logic for capturing exception RuntimeException.- Returns:
- An instance of Matcher.
- Since:
- 2.6.0
-
matchWithNoMatchLogic
@Deprecated public static Matcher matchWithNoMatchLogic(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic) Deprecated.Use match(String, String, Function, IRegExMatcherConfig) instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to match.text- The text where to find the pattern.matchLogic- The logic to be used for matching the regex.matchFoundLogic- The logic executed when the pattern was found.noMatchFoundLogic- The logic executed when the pattern was not found.- Returns:
- An instance of Matcher.
- Since:
- 2.6.0
-
matchWithNoMatchLogic
@Deprecated public static Matcher matchWithNoMatchLogic(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Consumer<Matcher> noMatchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use match(String, String, Function, IRegExMatcherConfig) instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to match.text- The text where to find the pattern.matchLogic- The logic to be used for matching the regex.matchFoundLogic- The logic executed when the pattern was found.noMatchFoundLogic- The logic executed when the pattern was not found.exceptionLogic- The logic for capturing exception RuntimeException.- Returns:
- An instance of Matcher.
- Since:
- 2.6.0
-
matchByRegEx
@Deprecated public static Matcher matchByRegEx(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Sink noMatchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use matchWithNoMatchLogic instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchLogic- The logic to be executed for matching the pattern.matchFoundLogic- The logic executed when the pattern was found.noMatchFoundLogic- The logic executed when the pattern was not found.exceptionLogic- The logic for capturing exception RuntimeException.- Returns:
- An instance of Matcher.
-
matchByRegEx
@Deprecated public static Matcher matchByRegEx(String pattern, String text, Consumer<Matcher> matchFoundLogic, Sink noMatchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use findWithNoMatchLogic instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchFoundLogic- The logic executed when the pattern was found.noMatchFoundLogic- The logic executed when the pattern was not found.exceptionLogic- The logic for capturing exception RuntimeException.- Returns:
- An instance of Matcher.
-
matchByRegEx
@Deprecated public static Matcher matchByRegEx(String pattern, String text, Consumer<Matcher> matchFoundLogic, Sink noMatchFoundLogic) Deprecated.Use findWithNoMatchLogic instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchFoundLogic- The logic executed when the pattern was found.noMatchFoundLogic- The logic executed when the pattern was not found.- Returns:
- An instance of Matcher.
-
matchByRegEx
@Deprecated public static Matcher matchByRegEx(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Sink noMatchFoundLogic) Deprecated.Use matchWithNoMatchLogic instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchLogic- The logic to be executed for matching the pattern.matchFoundLogic- The logic executed when the pattern was found.noMatchFoundLogic- The logic executed when the pattern was not found.- Returns:
- An instance of Matcher.
-
matchByRegEx
@Deprecated public static Matcher matchByRegEx(String pattern, String text, Consumer<Matcher> matchFoundLogic) Deprecated.Use findWithMatchLogic instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchFoundLogic- The logic executed when the pattern was found.- Returns:
- An instance of Matcher.
-
matchByRegEx
@Deprecated public static Matcher matchByRegEx(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic) Deprecated.Use matchWithMatchLogic instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchLogic- The logic to be executed for matching the pattern.matchFoundLogic- The logic executed when the pattern was found.- Returns:
- An instance of Matcher.
-
matchByRegEx
@Deprecated public static Matcher matchByRegEx(String pattern, String text, Consumer<Matcher> matchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use findWithMatchLogic instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchFoundLogic- The logic executed when the pattern was found.exceptionLogic- The logic for capturing exception RuntimeException.- Returns:
- An instance of Matcher.
-
matchByRegEx
@Deprecated public static Matcher matchByRegEx(String pattern, String text, Function<Matcher, Boolean> matchLogic, Consumer<Matcher> matchFoundLogic, Consumer<RuntimeException> exceptionLogic) Deprecated.Use matchWithMatchLogic instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchLogic- The logic to be executed for matching the pattern.matchFoundLogic- The logic executed when the pattern was found.exceptionLogic- The logic for capturing exception RuntimeException.- Returns:
- An instance of Matcher.
-
matchByRegEx
Deprecated.Use find instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.- Returns:
- An instance of Matcher.
-
matchByRegEx
@Deprecated public static Matcher matchByRegEx(String pattern, String text, Function<Matcher, Boolean> matchLogic) Deprecated.Use match instead.Find the RegEx from a text.- Parameters:
pattern- The RegEx pattern to find.text- The text where to find the pattern.matchLogic- The logic to be executed for matching the pattern.- Returns:
- An instance of Matcher.
-