diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/qif.rs | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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)) |