fixed issue with find not working with symbols that should be escaped (#13792)

# Description

Thanks to @weirdan's suggestion, this now works.

![image](https://github.com/user-attachments/assets/34522c7b-b012-4f73-883d-9913142e85b9)

Closes #13789
This commit is contained in:
Darren Schroeder
2024-09-05 18:22:03 -05:00
committed by GitHub
parent b2cab3274b
commit 870eb2530c
2 changed files with 62 additions and 1 deletions

View File

@ -193,7 +193,8 @@ pub fn highlight_search_string(
string_style: &Style,
highlight_style: &Style,
) -> Result<String, ShellError> {
let regex_string = format!("(?i){needle}");
let escaped_needle = regex::escape(needle);
let regex_string = format!("(?i){escaped_needle}");
let regex = match Regex::new(&regex_string) {
Ok(regex) => regex,
Err(err) => {