RegExpCursor

class RegExpCursor(text: Text, query: String, options: Set<RegexOption> = emptySet(), from: DocPos = DocPos.ZERO, to: DocPos = text.endPos) : Iterator<SearchMatch>

A cursor that iterates over regex matches in a Text document.

Parameters

text

The document text to search through.

query

The regex pattern string.

options

Regex options (e.g. RegexOption.IGNORE_CASE).

from

Start position of the search range.

to

End position of the search range.

Constructors

Link copied to clipboard
constructor(text: Text, query: String, options: Set<RegexOption> = emptySet(), from: DocPos = DocPos.ZERO, to: DocPos = text.endPos)

Properties

Link copied to clipboard

Whether the cursor has been exhausted.

Link copied to clipboard

The groups from the last match result, if any.

Link copied to clipboard

The current match, or null if iteration hasn't started or is done.

Functions

Link copied to clipboard
open operator override fun hasNext(): Boolean
Link copied to clipboard
open operator override fun next(): SearchMatch
Link copied to clipboard

Return the next match, or null if there are no more matches.