Skip to main content

count_capturing_groups

Function count_capturing_groups 

Source
pub fn count_capturing_groups(pattern: &str) -> usize
Expand description

Count capturing groups in a regex pattern string (for validating with_pattern / custom types).

Handles (?P<name>...) named captures; other (?...) extensions are treated as non-capturing at the opening parenthesis (same rule of thumb as skipping (?:...), (?=...), etc.).