Regex expression pulling too much

I have a process that takes the body of an email and i use regex to pull out certain data. I have 3 instances were it is pulling the correct data but also pulling the last 2 characters of my regex expression. All of the other instances work just fine.

Here is the expressions and images to reference. How do i get it to not have that first 2 characters?

  1. System.Text.RegularExpressions.Regex.Match(EmailBody,“(?<=Keep email address for how long?).+”.Trim).ToString

  2. System.Text.RegularExpressions.Regex.Match(EmailBody,“(?<=Who will be monitoring mailbox?).+”.Trim).ToString

  3. System.Text.RegularExpressions.Regex.Match(EmailBody,“(?<=Auto response until?).+”.Trim).ToString

Here is the output:
image

Here is what EmailBody variable is written in a message box:
image

grafik
escape question mark
grafik

I can’t thank you enough.

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