Skip to main content

parse_flags

Function parse_flags 

Source
pub fn parse_flags(
    raw_flags: &str,
) -> Result<(SubstFlags, Option<usize>), SubstError>
Expand description

Parse a substitute flags+count tail: [flag-chars][ optional trailing count], e.g. "g", "gi 3", "". This is the segment after the closing / delimiter in :s/pat/rep/flags, and — for [B17] bare :s [flags] [count] (repeat-last-substitute) — the ENTIRE argument string, since there’s no delimiter at all in that form.

§Errors

Returns an error on an unrecognized flag character or non-numeric trailing text.