pub fn is_glob(path: &str) -> boolExpand description
Determines if a given path string contains unescaped glob pattern characters.
§Parameters :
path: A reference to a string slice (&str) representing the path to be checked.
§Returns :
bool: Returnstrueif the path contains unescaped glob pattern characters (*,?,[,{), otherwisefalse. The function takes into account escape sequences, and only considers glob characters outside of escape sequences.
§Behavior :
- The function handles escaped characters (
\) and identifies unescaped glob characters and sequences. - It correctly interprets nested and escaped brackets (
[,]) and braces ({,}).
§Examples :
use pth ::path;
assert_eq!( path ::is_glob( "file.txt" ), false ); // No glob patterns
assert_eq!( path ::is_glob( "*.txt" ), true ); // Contains unescaped glob character *
assert_eq!( path ::is_glob( "\\*.txt" ), false ); // Escaped *, not a glob pattern
assert_eq!( path ::is_glob( "file[0-9].txt" ), true ); // Unescaped brackets indicate a glob pattern
assert_eq!( path ::is_glob( "file\\[0-9].txt" ), false ); // Escaped brackets, not a glob pattern