XRegex

class XRegex(source)

Represents a compiled regular expression. Provides functions to match strings in text with a pattern, replace the found occurrences and split text around matches.

Note that in the future, the behavior of regular expression matching and replacement functions can be altered to match JVM implementation behavior where differences exist.

Constructors

Link copied to clipboard
constructor(pattern: String, version: SchemaVersion)

Creates a regular expression from the specified pattern string and the default options.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The pattern string of this regular expression.

Functions

Link copied to clipboard

Indicates whether the regular expression can find at least one match in the specified input.

Link copied to clipboard
fun find(input: CharSequence, startIndex: Int = 0): XMatchResult?

Returns the first match of a regular expression in the input, beginning at the specified startIndex.

Link copied to clipboard
fun findAll(input: CharSequence, startIndex: Int = 0): Sequence<XMatchResult>

Returns a sequence of all occurrences of a regular expression within the input string, beginning at the specified startIndex.

Link copied to clipboard
fun matchAt(input: CharSequence, index: Int): XMatchResult?
Link copied to clipboard
fun matchEntire(input: CharSequence): XMatchResult?

Attempts to match the entire input CharSequence against the pattern.

Link copied to clipboard
infix fun matches(input: CharSequence): Boolean

Indicates whether the regular expression matches the entire input.

Link copied to clipboard
fun matchesAt(input: CharSequence, index: Int): Boolean
Link copied to clipboard
open override fun toString(): String

Returns the string representation of this regular expression, namely the pattern of this regular expression.