diff options
| -rw-r--r-- | src/parsers/eversource.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parsers/eversource.rs b/src/parsers/eversource.rs index 3c1b27e..0716839 100644 --- a/src/parsers/eversource.rs +++ b/src/parsers/eversource.rs @@ -2,8 +2,8 @@ use eyre::OptionExt; use grate::tracing; lazy_static::lazy_static! { - pub static ref ACCOUNT_REGEX: regex::Regex = regex::Regex::new(r#"\bEBILL Account Number: [*]+([\d]{4})\b"#).unwrap(); - pub static ref MONEY_REGEX: regex::Regex = regex::Regex::new(r#"\bThe total amount due of \$(\d+\.\d{2}) has been scheduled\b"#).unwrap(); + pub static ref ACCOUNT_REGEX: regex::Regex = regex::Regex::new(r#"\bAccount Number: [*]+([\d]{4})\b"#).unwrap(); + pub static ref MONEY_REGEX: regex::Regex = regex::Regex::new(r#"\bThe total (?:amount due )?of \$(\d+\.\d{2}) (?:has been scheduled|is due by)\b"#).unwrap(); } #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] @@ -13,7 +13,7 @@ pub struct Record { } pub fn parse(message: &mail_parser::Message) -> eyre::Result<Record> { - let text = message.body_text(0).ok_or_eyre("no text")?; + let text = message.body_html(0).ok_or_eyre("no text")?; let acct_match = ACCOUNT_REGEX.captures(&text).ok_or_eyre("no account match")?; let last4 = acct_match.get(1).expect("no matching group").as_str().parse::<usize>()?; |