method Regex.compile
Compiles at run time; prefer the literal re"…", which is checked when the program is built.
Example:
fn main() io {
let re = Regex.compile("[a-z]+")!
print("{re.matches("abc")}")
}Вывод
true
pub(api) static fn compile(pattern: str) -> Regex | ParseErrorС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
pattern | str |
Возвращает
Ошибки
ParseError@error
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/text.oxl:1247