type

RegexMatcher

src class RegexMatcher : Obj

RegexMatcher is used in matching operations on a regular expression.

methods

end

Return end index+1 of the given group.

find

Attempt to find the next match.

group

Return the substring captured by the matching operation.

groupCount

Return the number of capturing groups or zero if no match.

matches

Match the entire region against the pattern.

replaceAll

Replace every sequence which matches the pattern with the given replacement string.

replaceFirst

Replace the first sequence which matches the pattern with the given replacment string.

start

Return the start index of the given group.

Slot Details

end

src Int end(Int group := 0)

Return end index+1 of the given group. Throw exception if failed to match input or group index is invalid.

find

src 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.

group

src Str? group(Int group := 0)

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.

groupCount

src Int groupCount()

Return the number of capturing groups or zero if no match. Group zero is not included.

matches

src 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.

replaceAll

src Str replaceAll(Str replacement)

Replace every sequence which matches the pattern with the given replacement string.

replaceFirst

src Str replaceFirst(Str replacement)

Replace the first sequence which matches the pattern with the given replacment string.

start

src Int start(Int group := 0)

Return the start index of the given group. Throw exception if failed to match input or group index is invalid.