Regex negative inclusion

Hi, including “(?!Due)Date” in my regular expression to match Invoice Date etc. still is matching “Due Date 2/15/2020”
Can you help? Thanks,

(?i)(?<=(Invoice|Billing|Bill|Statement|Date Billed|(?<!Due)Date)\s*(Date|Issued)?\s*:?\s*)\s?(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|Jun(e)?|Jul(y)?|Aug(ust)?|Sep(tember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?)\s?.?\s?\d+,?\s?\d+|\s?(\d{1,2}/\d{1,2}/\d{2,4}|\d{1,2}-(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|Jun(e)?|Jul(y)?|Aug(ust)?|Sep(tember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?)-\d{2,4})

Hi @A_Learner

Please try this

(?i)(?<=(Invoice|Billing|Bill|Statement|Date Billed|Date(?! Due)\s*):?\s*)\s?(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|Jun(e)?|Jul(y)?|Aug(ust)?|Sep(tember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?)\s?.?\s?\d+,?\s?\d+|\s?(\d{1,2}/\d{1,2}/\d{2,4}|\d{1,2}-(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|Jun(e)?|Jul(y)?|Aug(ust)?|Sep(tember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?)-\d{2,4})

Regards,

Thank you, but it is matching

Due Date:6/26/2023
Due By: 6/26/2023
Due Date Jul 24, 2023
Due Date: 06-Jul-23
Pay Now Due 07/10/2023

Thank you,

HI,

How about the following pattern?

(?i)(?<=(Invoice|Billing|Bill|Statement|Date Billed|(?<!Due\s*)Date)\s*(Date|Issued)?\s*:?\s*)\s?((Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|Jun(e)?|Jul(y)?|Aug(ust)?|Sep(tember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?)\s?.?\s?\d+,?\s?\d+|\s?(\d{1,2}/\d{1,2}/\d{2,4}|\d{1,2}-(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|Jun(e)?|Jul(y)?|Aug(ust)?|Sep(tember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?)-\d{2,4}))

Regards,

1 Like

@Yoichi Great!! Thanks!!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.