Interface RE.Match
- All Superinterfaces:
CharSequence, RE.MatchGroup
- Enclosing interface:
RE
The result of a matched group after a successful find, matches, or
lookingAt operation.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanThis Match has a rover its the matching region.Get the matching groups.Get the matching groups with their value.group(int group) Get a group by name.presentGroup(String groupName) This gets the value of a group but throws an exception of the group is not there.default voidThis Match has a rover in its the matching region.default StringThis Match has a rover in its the matching region.This Match has a rover in its the matching region.Methods inherited from interface CharSequence
charAt, chars, codePoints, getChars, isEmpty, length, subSequence, toStringMethods inherited from interface RE.MatchGroup
end, getMatcher, name, start, value
-
Method Details
-
getGroups
Map<String, RE.MatchGroup> getGroups()Get the matching groups. This will only return the groups that were captured. -
getGroupValues
-
group
Get a group by name. This will throw an exception if the group was not defined in this regular expression. It will return an Optional.empty() when the group wasn't captured.- Parameters:
name- the name of the group
-
take
This Match has a rover in its the matching region. This method requires the expected to match against the current position or it will throw an exception. It will move the rover forward to after the match. It will skip any whitespace before it matches.- Parameters:
expected- the expected match- Returns:
- the value of the match
-
skip
This Match has a rover in its the matching region. This method requires the skip to match against the current position or it will throw an exception. It will move the rover forward to after the match.- Parameters:
skip- the RE to skip
-
check
This Match has a rover its the matching region. This method will see if the current position matches the RE. If it does, the rover will be moved forward. Otherwise it stays where it is. It will skip any whitespace before it matches.- Parameters:
expected- the expected value- Returns:
- true if there was a match and the match was consumed
-
tryMatch
This Match has a rover in its the matching region. This method tries too see if the string from this rover to the end of this match, matches the match parameter. If so, it returns the value and moves the rover forward.- Parameters:
match- the RE to match return a string when matched or null
-
group
-
presentGroup
-