Regular expression capabilities provided by the Regex package.
isMatch = Regex.matches("\d+", "123");
| Method | Description |
|---|---|
Regex.match(pattern, text) | Returns a Match struct or null. |
Regex.matches(pattern, text) | Returns true/false if entire text matches. |
Regex.findAll(pattern, text) | Returns array of Match structs. |
Regex.replace(pattern, text, repl) | Replace all matches. |
Regex.split(pattern, text) | Split text by pattern. |
The Match struct returned by match and findAll contains:
index: The start index of the match.value: The matched string.groups: An array of captured groups (including the full match at index 0).