summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-04-04 17:17:09 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-04-04 17:17:09 +0200
commitf1b973a4eb00c6aed1dc17a39c87d1c47fcf182a (patch)
tree7560936c610daec4919c967745875f3554632b94
parent393eba224683f5ac475f9af1ede63478eb8279df (diff)
More patterns
-rw-r--r--src/qif.rs6
1 files 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))