Function grep_cli::pattern_from_bytes

source ยท
pub fn pattern_from_bytes(pattern: &[u8]) -> Result<&str, InvalidPatternError>
Expand description

Convert arbitrary bytes 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.