From e53c48cc93b707a607ad8833cc10818719b86c42 Mon Sep 17 00:00:00 2001 From: Peter Bartyik Date: Thu, 3 Sep 2020 13:06:10 +0200 Subject: [PATCH] fix regexp parsing from tmux config --- src/swapper.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/swapper.rs b/src/swapper.rs index a7ef585..1864ff0 100644 --- a/src/swapper.rs +++ b/src/swapper.rs @@ -136,7 +136,7 @@ impl<'a> Swapper<'a> { let options = self.executor.execute(params); let lines: Vec<&str> = options.split('\n').collect(); - let pattern = Regex::new(r#"@thumbs-([\w\-0-9]+) "?(\w+)"?"#).unwrap(); + let pattern = Regex::new(r#"@thumbs-([\w\-0-9]+)\s+(.+)"#).unwrap(); let args = lines .iter() @@ -166,7 +166,7 @@ impl<'a> Swapper<'a> { } if name.starts_with("regexp") { - return vec!["--regexp".to_string(), format!("'{}'", value)]; + return vec!["--regexp".to_string(), format!("'{}'", value.replace("\\\\", "\\"))]; } vec![]