- Index
- »
- fan.sys
- »
- RegexMatcher
RegexMatcher
class RegexMatcher : Obj
RegexMatcher is used in matching operations on a regular expression.
Return the number of capturing groups or zero if no match
Attempt to find the next match
Return the start index of the given group
Return end index+1 of the given group
Replace the first sequence which matches the pattern with the given replacment string
Match the entire region against the pattern
Replace every sequence which matches the pattern with the given replacement string
Return the substring captured by the matching operation
Int end(Int group)
Return end index+1 of the given group. Throw exception if failed to match input or group index is invalid.
Bool find()
Attempt to find the next match. If a match is made then return true - additional info is available via the group, start, and end methods. Return false if a match cannot be made.
Str? group(Int group)
Return the substring captured by the matching operation. Group index zero denotes the entire pattern and capturing groups are indexed from left to right starting at one. Return null if group failed to match part of the input. Throw exception if failed to match input or group index is invalid.
Int groupCount()
Return the number of capturing groups or zero if no match. Group zero is not included.
Bool matches()
Match the entire region against the pattern. If a match is made then return true - additional info is available via the group, start, and end methods. Return false if a match cannot be made.
Str replaceAll(Str replacement)
Replace every sequence which matches the pattern with the given replacement string.
Str replaceFirst(Str replacement)
Replace the first sequence which matches the pattern with the given replacment string.
Int start(Int group)
Return the start index of the given group. Throw exception if failed to match input or group index is invalid.