RS.CLIPPY.INVALID_REGEX

Invalid regular expressions

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: invalid_regex. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks regex creation (with Regex::new, RegexBuilder::new, or RegexSet::new) for correct regex syntax.

Why is this bad?

This will lead to a runtime panic.

Example

Regex::new("(")

Use instead:

Regex::new("\\(")