mirror of
				https://github.com/BurntSushi/ripgrep.git
				synced 2025-10-30 23:17:47 +02:00 
			
		
		
		
	globset: clarify documentation on regex method
This makes it clear that the `bytes` API of the regex crate should be used instead of the Unicode API. Fixes #985
This commit is contained in:
		| @@ -275,6 +275,19 @@ impl Glob { | ||||
|     } | ||||
|  | ||||
|     /// Returns the regular expression string for this glob. | ||||
|     /// | ||||
|     /// Note that regular expressions for globs are intended to be matched on | ||||
|     /// arbitrary bytes (`&[u8]`) instead of Unicode strings (`&str`). In | ||||
|     /// particular, globs are frequently used on file paths, where there is no | ||||
|     /// general guarantee that file paths are themselves valid UTF-8. As a | ||||
|     /// result, callers will need to ensure that they are using a regex API | ||||
|     /// that can match on arbitrary bytes. For example, the | ||||
|     /// [`regex`](https://crates.io/regex) | ||||
|     /// crate's | ||||
|     /// [`Regex`](https://docs.rs/regex/*/regex/struct.Regex.html) | ||||
|     /// API is not suitable for this since it matches on `&str`, but its | ||||
|     /// [`bytes::Regex`](https://docs.rs/regex/*/regex/bytes/struct.Regex.html) | ||||
|     /// API is suitable for this. | ||||
|     pub fn regex(&self) -> &str { | ||||
|         &self.re | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user