Function grep_cli::pattern_from_os

source ยท
pub fn pattern_from_os(pattern: &OsStr) -> Result<&str, InvalidPatternError>
Expand description

Convert an OS string into a regular expression pattern.

This conversion fails if the given pattern is not valid UTF-8, in which case, a targeted error with more information about where the invalid UTF-8 occurs is given. The error also suggests the use of hex escape sequences, which are supported by many regex engines.