REGEX for Strings that have a Certain String, but Exclude those that have a Certain string Prior

Hi Guys!

I have a query on a Regex expression.

Given:
I have these strings randomly:
1. Shipment Deadline:
2. Closing Deadline:
3. Cut-Off Deadline:

I would need to get any value that would have “Deadline:”
But I don’t want the “Shipment Deadline:” or even possibly "Shipment xxxxx Deadline:"

How can exclude matches that would have “Shipment?”
System.Text.RegularExpressions.Regex.Matches(in_Str, “(?i)(deadline)(\D|\d){1,40}\d{4}\D\d{2}\D\d{2}”)

Thank you!

Hi,

How about the following pattern?

(?<!Shipment\s(\w+\s)?)Deadline

If you need date string after the above “Deadline:”, the following will help you.

(?<=(?<!Shipment\s(\w+\s)?)Deadline:)\d+/\d+/\d+

Regards

Wow! Thank you Yoichi! This is perfect! Have a great day!

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