method
Regex.next
Regex.next(text, re, from) -> Match
Returns the first match of re in text starting at or after byte offset from, or null. Loop it from the previous match's end (see Regex.end) to iterate every match — the find-all idiom.
Parameters
textthe string to searchrea compiled Regexfromthe byte offset to resume fromExample
program Demo {
entry {
let re = Regex.compile("#(\\w+)")
var m = Regex.exec("#a #b #c", re)
while Regex.ok(m) {
print(Regex.group(m, 1))
m = Regex.next("#a #b #c", re, Regex.end(m, 0))
}
}
}