From 8b2574e90b1d0c3eb454965111c980736bae9c99 Mon Sep 17 00:00:00 2001 From: mii Date: Tue, 6 Dec 2022 15:55:17 +0000 Subject: [PATCH] fix code block regex --- src/tts/validator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tts/validator.rs b/src/tts/validator.rs index 6a9d71c..521ab37 100644 --- a/src/tts/validator.rs +++ b/src/tts/validator.rs @@ -2,7 +2,7 @@ use regex::Regex; pub fn remove_url(text: String) -> String { let url_regex = Regex::new(r"(http://|https://){1}[\w\.\-/:\#\?=\&;%\~\+]+").unwrap(); - let code_regex = Regex::new(r"```(.*)\n(.*)\n```").unwrap(); + let code_regex = Regex::new(r"```([.\n]*)```").unwrap(); let text = url_regex.replace_all(&text, " URL ").to_string(); code_regex.replace_all(&text, "code").to_string() }