expression

Unsupported look-around and backreferences

The regex crate deliberately excludes constructs such as look-around and backreferences to support predictable search complexity. Use explicit Rust checks for constraints that require comparing captured values. This example uses the external regex crate; see the staged Cargo manifest. Expected stdout (not executed): true true Common mistake: Assuming every PCRE or JavaScript expression is accepted.

Formal Syntax & Structure

rust syntaxrust
Regex::new(pattern).is_err()

Working Example

Example Snippetrust
fn main() {    for pattern in [r"a(?=b)", r"(a)\1"] { println!("{}", regex::Regex::new(pattern).is_err()); }}
Rust Reference