Class Parser
- java.lang.Object
-
- org.schabi.newpipe.extractor.utils.Parser
-
public final class Parser extends java.lang.ObjectAvoid using regex !!!
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParser.RegexException
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.String>compatParseMap(java.lang.String input)static booleanisMatch(java.lang.String pattern, java.lang.String input)static booleanisMatch(java.util.regex.Pattern pattern, java.lang.String input)static java.lang.StringmatchGroup(java.lang.String pattern, java.lang.String input, int group)Matches the specified group of the given pattern against the input, and returns the matched groupstatic java.lang.StringmatchGroup(java.util.regex.Pattern pattern, java.lang.String input, int group)Matches the specified group of the given pattern against the input, and returns the matched groupstatic java.lang.StringmatchGroup1(java.lang.String pattern, java.lang.String input)Matches group 1 of the given pattern against the input and returns the matched groupstatic java.lang.StringmatchGroup1(java.util.regex.Pattern pattern, java.lang.String input)Matches group 1 of the given pattern against the input and returns the matched groupstatic java.lang.StringmatchGroup1MultiplePatterns(java.util.regex.Pattern[] patterns, java.lang.String input)Matches multiple patterns against the input string and returns the first successful matcherstatic java.util.regex.MatchermatchMultiplePatterns(java.util.regex.Pattern[] patterns, java.lang.String input)Matches multiple patterns against the input string and returns the first successful matcherstatic java.util.regex.MatchermatchOrThrow(java.util.regex.Pattern pattern, java.lang.String input)
-
-
-
Method Detail
-
matchOrThrow
@Nonnull public static java.util.regex.Matcher matchOrThrow(@Nonnull java.util.regex.Pattern pattern, java.lang.String input) throws Parser.RegexException- Throws:
Parser.RegexException
-
matchGroup1
@Nonnull public static java.lang.String matchGroup1(java.lang.String pattern, java.lang.String input) throws Parser.RegexExceptionMatches 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 java.lang.String matchGroup1(java.util.regex.Pattern pattern, java.lang.String input) throws Parser.RegexExceptionMatches 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 java.lang.String matchGroup(java.lang.String pattern, java.lang.String input, int group) throws Parser.RegexExceptionMatches 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 java.lang.String matchGroup(@Nonnull java.util.regex.Pattern pattern, java.lang.String input, int group) throws Parser.RegexExceptionMatches 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 java.lang.String matchGroup1MultiplePatterns(java.util.regex.Pattern[] patterns, java.lang.String input) throws Parser.RegexExceptionMatches 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 java.util.regex.Matcher matchMultiplePatterns(java.util.regex.Pattern[] patterns, java.lang.String input) throws Parser.RegexExceptionMatches 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
public static boolean isMatch(java.lang.String pattern, java.lang.String input)
-
isMatch
public static boolean isMatch(@Nonnull java.util.regex.Pattern pattern, java.lang.String input)
-
compatParseMap
@Nonnull public static java.util.Map<java.lang.String,java.lang.String> compatParseMap(@Nonnull java.lang.String input)
-
-