Show More
@@ -24,7 +24,7 b' use std::vec::Vec;' | |||||
24 | lazy_static! { |
|
24 | lazy_static! { | |
25 | static ref RE_ESCAPE: Vec<Vec<u8>> = { |
|
25 | static ref RE_ESCAPE: Vec<Vec<u8>> = { | |
26 | let mut v: Vec<Vec<u8>> = (0..=255).map(|byte| vec![byte]).collect(); |
|
26 | let mut v: Vec<Vec<u8>> = (0..=255).map(|byte| vec![byte]).collect(); | |
27 |
let to_escape = b"()[]{}?*+-|^$\\.&~# |
|
27 | let to_escape = b"()[]{}?*+-|^$\\.&~#\t\n\r\x0b\x0c"; | |
28 | for byte in to_escape { |
|
28 | for byte in to_escape { | |
29 | v[*byte as usize].insert(0, b'\\'); |
|
29 | v[*byte as usize].insert(0, b'\\'); | |
30 | } |
|
30 | } | |
@@ -641,8 +641,8 b' mod tests {' | |||||
641 | assert_eq!(escape_pattern(untouched), untouched.to_vec()); |
|
641 | assert_eq!(escape_pattern(untouched), untouched.to_vec()); | |
642 | // All escape codes |
|
642 | // All escape codes | |
643 | assert_eq!( |
|
643 | assert_eq!( | |
644 |
escape_pattern(br#"()[]{}?*+-|^$\\.&~# |
|
644 | escape_pattern(br#"()[]{}?*+-|^$\\.&~#\t\n\r\v\f"#), | |
645 |
br#"\(\)\[\]\{\}\?\*\+\-\|\^\$\\\\\.\&\~\#\ |
|
645 | br#"\(\)\[\]\{\}\?\*\+\-\|\^\$\\\\\.\&\~\#\\t\\n\\r\\v\\f"# | |
646 | .to_vec() |
|
646 | .to_vec() | |
647 | ); |
|
647 | ); | |
648 | } |
|
648 | } |
General Comments 0
You need to be logged in to leave comments.
Login now