Class Parser
java.lang.Object
org.schabi.newpipe.extractor.utils.Parser
Avoid using regex !!!
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncompatParseMap(String input) static booleanstatic booleanstatic StringmatchGroup(String pattern, String input, int group) Matches the specified group of the given pattern against the input, and returns the matched groupstatic StringmatchGroup(Pattern pattern, String input, int group) Matches the specified group of the given pattern against the input, and returns the matched groupstatic StringmatchGroup1(String pattern, String input) Matches group 1 of the given pattern against the input and returns the matched groupstatic StringmatchGroup1(Pattern pattern, String input) Matches group 1 of the given pattern against the input and returns the matched groupstatic StringmatchGroup1MultiplePatterns(Pattern[] patterns, String input) Matches multiple patterns against the input string and returns the first successful matcherstatic MatchermatchMultiplePatterns(Pattern[] patterns, String input) Matches multiple patterns against the input string and returns the first successful matcherstatic MatchermatchOrThrow(Pattern pattern, String input)
-
Method Details
-
matchOrThrow
@Nonnull public static Matcher matchOrThrow(@Nonnull Pattern pattern, String input) throws Parser.RegexException - Throws:
Parser.RegexException
-
matchGroup1
@Nonnull public static String matchGroup1(String pattern, String input) throws Parser.RegexException Matches group 1 of the given pattern against the input and returns the matched group- Parameters:
pattern- The regex pattern to match.input- The input string to match against.- Returns:
- The matching group as a string.
- Throws:
Parser.RegexException- If the pattern does not match the input or if the group is not found.
-
matchGroup1
@Nonnull public static String matchGroup1(Pattern pattern, String input) throws Parser.RegexException Matches group 1 of the given pattern against the input and returns the matched group- Parameters:
pattern- The regex pattern to match.input- The input string to match against.- Returns:
- The matching group as a string.
- Throws:
Parser.RegexException- If the pattern does not match the input or if the group is not found.
-
matchGroup
@Nonnull public static String matchGroup(String pattern, String input, int group) throws Parser.RegexException Matches the specified group of the given pattern against the input, and returns the matched group- Parameters:
pattern- The regex pattern to match.input- The input string to match against.group- The group number to retrieve (1-based index).- Returns:
- The matching group as a string.
- Throws:
Parser.RegexException- If the pattern does not match the input or if the group is not found.
-
matchGroup
@Nonnull public static String matchGroup(@Nonnull Pattern pattern, String input, int group) throws Parser.RegexException Matches the specified group of the given pattern against the input, and returns the matched group- Parameters:
pattern- The regex pattern to match.input- The input string to match against.group- The group number to retrieve (1-based index).- Returns:
- The matching group as a string.
- Throws:
Parser.RegexException- If the pattern does not match the input or if the group is not found.
-
matchGroup1MultiplePatterns
public static String matchGroup1MultiplePatterns(Pattern[] patterns, String input) throws Parser.RegexException Matches multiple patterns against the input string and returns the first successful matcher- Parameters:
patterns- The array of regex patterns to match.input- The input string to match against.- Returns:
- A
Matcherfor the first successful match. - Throws:
Parser.RegexException- If no patterns match the input or ifpatternsis empty.
-
matchMultiplePatterns
public static Matcher matchMultiplePatterns(Pattern[] patterns, String input) throws Parser.RegexException Matches multiple patterns against the input string and returns the first successful matcher- Parameters:
patterns- The array of regex patterns to match.input- The input string to match against.- Returns:
- A
Matcherfor the first successful match. - Throws:
Parser.RegexException- If no patterns match the input or ifpatternsis empty.
-
isMatch
-
isMatch
-
compatParseMap
-