method
Regex.matches
Regex.matches(text, pattern) -> bool
Searches text for pattern and returns whether it matches anywhere (like a search, not a full-string match — anchor with ^…$ for that). Compiles the pattern each call; for a pattern you use repeatedly, compile once with Regex.compile and use Regex.test.
Parameters
textthe string to searchpatternthe regular expression sourceExample
program Demo {
entry {
if Regex.matches("/quit now", "^/(help|quit)\\b") { print(1) }
}
}