Regex Email Filtering Help

Hello everyone,

I need some help with some regex… I am currently trying to find all information between two specific set of words. In this case between the words "Test Plan: " and “Back Out Recovery”. The issue I am having is that earlier in the email there is another instance of the words "Test Plan: " and my regex is only pulling the first one which includes the second instance of "Test Plan: ". I thought that my IEnumerable would contain 2 objects, the first of which would be from the first instance of "Test Plan: " all the way down to “Back Out Recovery” but there is only one object.

Sorry for the wall of text that is very confusing so I will add pictures to demonstrate what I mean.
SO, the entire email lets say looks like this:

I want to extract this information:

My regex is currently ONLY extracting this information:

The regex I am currently using is this:

Using the above, my iEnumerable only contains one object.

Please help :).

Thanks!

1 Like

Hi,

If you want to get only 2nd “Test Plan” content like your 2nd image, check “Right to Left” Regex Option

If you want to get two matches for “Test Plan” content, perhaps you should use the following pattern , because it seems there is no white space between the first Back and Out

"(?<=Test Plan:)([\S\s]*?)(?=Back\s*Out Plan)"

Regards,

Hi
In addition to what @Yoichi mentioned this expression would help you on the same

(?<=Test Plan:).*(?=Back Out Recovery)

Cheers @rileythiessen

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