From f1b973a4eb00c6aed1dc17a39c87d1c47fcf182a Mon Sep 17 00:00:00 2001 From: Justin Wernick Date: Tue, 4 Apr 2023 17:17:09 +0200 Subject: More patterns --- src/qif.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qif.rs b/src/qif.rs index 5011ae1..0e60520 100644 --- a/src/qif.rs +++ b/src/qif.rs @@ -109,14 +109,15 @@ fn remove_date(text: &str) -> String { fn remove_card_number(text: &str) -> String { lazy_static! { - static ref CARD_NUM_REGEX: Regex = Regex::new(r"\d{6}\*+\d{4}").unwrap(); + static ref CARD_NUM_REGEX: Regex = Regex::new(r"(\d{6}\*+\d{4}|\d{16})").unwrap(); } CARD_NUM_REGEX.replace_all(text, "").trim().to_string() } fn remove_payment_provider(text: &str) -> String { lazy_static! { - static ref PURCH_REGEX: Regex = Regex::new(r"(?i)^(purch( payfast\*)?|pp \*)").unwrap(); + static ref PURCH_REGEX: Regex = + Regex::new(r"(?i)^(purch( payfast\*)?|pp \*|c\*|yoco \*|ikh*)").unwrap(); } PURCH_REGEX.replace_all(text, "").trim().to_string() } @@ -151,6 +152,7 @@ fn replace_common(text: &str) -> String { (r"(?i)(COUNTRY VIEW|STAR STOP|Shell|Sasol|Engen)", "Petrol"), (r"(?i)kung ?-?fu", "Kungfu Kitchen"), (r"(?i)^atm cash", "Cash"), + (r"(?i)DRS CL & ME LA", "Medipark 24") ) .into_iter() .map(|(from, to)| (Regex::new(from).unwrap(), to)) -- cgit v1.2.3