EN | DE

Stage 7.16: Regular Expressions

Regular Expressions (regex) is a common tool to check if text meets a predefined criteria.

Common use cases for it are email, number or domain verifications.

Rust provides the module regex::Regex to deal with regex.

But before you can start, you have to add regex = "1" to your Cargo.toml dependencies

A regex check consists of 3 parts:

  • A pattern which you define with Regex::new()
  • A string to check
  • The actual check with is_match(), which will return a bool

Further information: