API Reference › Regex › Regex.exec
method

Regex.exec

Regex.exec(text, re) -> Match

The compiled-pattern form of Regex.find: returns the first Match of the pre-compiled re in text, or null.

Parameters

textthe string to search
rea compiled Regex

Example

program Demo {
  entry {
    let re = Regex.compile("#(\\w+)")
    let m = Regex.exec("a #tag b", re)
    print(Regex.group(m, 1))
  }
}
← All symbols