API Reference › Regex › Regex.test
method

Regex.test

Regex.test(text, re) -> bool

The compiled-pattern form of Regex.matches: returns whether the pre-compiled re matches anywhere in text. No per-call parsing, so this is the one to call every frame.

Parameters

textthe string to search
rea compiled Regex from Regex.compile

Example

program Demo {
  entry {
    let re = Regex.compile("[a-z]+")
    if Regex.test("hello", re) { print(1) }
  }
}
← All symbols