Skip to main content

Greetings,

I am using Nintex On-Prem for SharePoint 2010. I am currently working on an  multiple approver Lazy Approval workflow. My goal is to extract the approver name and approver comments. I can capture the comments however when I do I get the text of the email stored in the variable as well. I need some assistance in creating a regular expression to strip out everything after the approval comments. I'm and admin and normally this would go to our developer who is out. The brief version of the text is here:

BIZDornKev -LazyApproval by MyEmailAddress Approve
Comment 1

From: Approvals-UAT@sharepoint-uat.>mailto:Approvals-UAT@sharepoint-uat.
Sent: Wednesday, July 05, 2017 9:35 AM
To: Kevin Dorn <kevin.dorn@
Subject: Approval Required #DDDZPKAQKNSJ#]

*******TEST SITE******
Workflow Notification
________________________________

You can approve this item by replying to this email with one of the following answers on the first line of the email:

Approve 

Below this is the text of the email that lists out item specific data that goes to the approver.

My current RegEx Pattern is 

Replace/Ignore Case

("ws,]+)s()ws]+)s(?:(d:./sw-]+)s()ws,]+)s(?<Comment>.*)

Replacement text Comment : "${Comment}"

Can someone guide me as to how to craft a RegEx that grabs everything before the FROM line above?

Any help is greatly appreciated

Kevin

Hello Kevin Dorn‌ – the following .NET Regex expression will find all characters leading up to the "From" string.

Is this what you're looking for? Depending on your string variable, you may need to also clean-up new-line characters before performing the RegEx extraction.


I may be wrong here, but that only took the last "FROM" and then matched the line before it.

Meaning it grabbed "Can someone guide me as to how to craft a RegEx that grabs everything before the " but not "BIZDornKev -LazyApproval by MyEmailAddress Approve
Comment 1". 

So it seems like this would only work as long as nobody put the word "FROM" somewhere in the email.


So you can add additional ":" character, so in the end you would have: .+?(?=From:) to be more sure wink.png


Judging from the comments above, you'd like to get the text between the "Approve" (immediately after the respondents email address) and the "From" text that is created whenever you receive an email reply... or at least I think that's the text that you'd like. 

Either way, here is the regex that will get it. 

(?<=approve|reject)csS]+(?=From:)

Here is a visual of what you'll capture (highlighted in blue): 

208975_pastedImage_1.png

This should also work in the event that they Reject / reject using this same method. Please note the case insensitivity flag (/i). You'll also probably need to trim anything grabbed with this method (using the Build String action) just to make sure that the whitespace is removed correctly. 

Is this what you were trying to do? 

if not, could you highlight the specific text that you're looking to grab? 



Reply