pattern.matcher(input)
always creates a new matcher, so you’d need to call matches()
again.
Try:
Matcher m = responseCodePattern.matcher(firstHeader);
m.matches();
m.groupCount();
m.group(0); //must call matches() first
...
More Related Contents:
- split US phone number in java? [closed]
- how to write regex for this expression in java
- Regular expression for SSN and phone number [closed]
- Regex for converting xml tags key to camel case
- Create array of regex matches
- Split string into array of character strings
- Java – How to find the redirected url of a url?
- Regex Named Groups in Java
- List of all special characters that need to be escaped in a regex
- Regular expression to match URLs in Java
- Using Java to find substring of a bigger string using Regular Expression
- Regex date format validation on Java
- Remove trailing zero in Java
- Are non-capturing groups redundant?
- How to match “any character” in regular expression?
- How exactly does String.split() method in Java work when regex is provided?
- method matches not work well [duplicate]
- Regular expression matching fully qualified class names
- Catastrophic backtracking shouldn’t be happening on this regex
- Character class subtraction, converting from Java syntax to RegexBuddy
- Remove all non-“word characters” from a String in Java, leaving accented characters?
- How to modify the header of a HttpUrlConnection
- How to escape a square bracket for Pattern compilation?
- Regular Expression for matching parentheses
- Java Regex – Using String’s replaceAll method to replace newlines
- Replace a String between two Strings
- Does Pattern.compile cache?
- Regex to remove spaces between numbers only
- Regex Pattern Catastrophic backtracking
- regex replace all ignore case