# text.matches · Rell standard library · Chromia Docs (concept)

> pure function matches(regex: text ): boolean Matches this text against the specified regular expression. Regular expressions use the same syntax as java.ut

Source: https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/text/matches/

FUNCTION

# text.matches

```signature
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`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/regex/Pattern.html).

Examples:

Rell

```
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](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/regex/Pattern.html)

Since 0.6.0

[View this page on docs.chromia.com](https://docs.chromia.com/pages/rell-stdlib/-rell%20-system%20-library/%5Broot%5D/text/matches.html)Generated API reference, mirrored from the live docs
