FUNCTION

text.matches

pure function matches(regex: text): boolean

Matches this text against the specified regular expression.

Regular expressions use the same syntax as java.util.regex.Pattern.

Examples:

val names = ["Alice", "Victor", "Viktor", "Victoria", "V\\ctor"];
print(names @* { .matches("Vi[a-z]tor") });  // prints [Victor, Viktor]
print(names @* { .matches("Vic.*") }); // prints [Victor, Victoria]
print(names @* { .matches("V\\\\c.*") }); // prints [V\ctor]

Parameters

  • regex — the regular expression to match against

Throws

  • exception — if regex is not a valid regular expression

See Also

  1. java.util.regex.Pattern - Java SE 21 & JDK 21

Since

0.6.0

© 2026 Chromia