RegExMatcher
classin packageklyn.regex
public class RegExMatcher extends Object
└ RegExMatcher

Iterates over the matches of a regular expression against one input string.

Matchers are created by RegEx.matcher. Each successful call to find updates the value returned by group, start, and end.

import klyn.regex

matcher = RegEx(r"([A-Za-z]+):(\d+)").matcher("alpha:12 beta:34")
while matcher.find():
    print(matcher.group(1), matcher.group(2))
Inherited Properties
propertyInherited Properties from Object: type
Methods
Modifier and Type Member Description
public native end
end(index as Long = 0) as Long
Returns the exclusive end offset of a captured group in the input.
public native find
find() as Boolean throws RegExException
Searches for the next occurrence of the regular expression.
public native group
group(index as Long = 0) as String
Returns the text captured by the current match or one of its groups.
public native reset
reset() as Void
Restarts matching at the beginning of the original input.
public native resetBuffer
resetBuffer(notnull chars as Char[], length as Long) as Void
Reuses this matcher with a prefix of a Unicode scalar buffer.
public native start
start(index as Long = 0) as Long
Returns the inclusive start offset of a captured group in the input.
Inherited Methods
methodInherited Methods from Object: deepCopy, fromJson, hash, toDict, toJson, toMap, toString, toXml