Skip to main content

regexp_split_to_array_count

Function regexp_split_to_array_count 

Source
pub fn regexp_split_to_array_count(text: &str, regexp: &Regex) -> usize
Expand description

How many chunks regexp_split_to_array would return, without building them.

One chunk per kept match plus the trailing remainder, keeping a match exactly when it is not zero-length at the start or end of the string. This must mirror the split’s rule so a caller sizing an allocation refuses only what the split itself would refuse. tests::test_regexp_split_array_count pins the two together.