---
id: regex-matches
name: Regex.matches
category: regex
kind: namespace-method
tokens: Regex.matches
sig: Regex.matches(text, pattern) -> bool
tip: True if the pattern matches anywhere in the text (a search).
order: 3
ns: Regex
member: matches
---
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:
- `text` — the string to search
- `pattern` — the regular expression source
```ludic
program Demo {
entry {
if Regex.matches("/quit now", "^/(help|quit)\\b") { print(1) }
}
}
```