cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

I need regular expression for extracting info from workflow comments

I have workflow that is sent to multiple approvers with First response applies.  From the workflow comments that  I store in the field, I would like to extract only the information about user and time the response was sent (approve or reject).  Based on my research this is doable using a regular expression. I need help with creating the regular expression pattern. Help!

Labels: (1)
0 Kudos
Reply
24 Replies
Not applicable

Re: I need regular expression for extracting info from workflow comments

It depends on how you are storing the comments in the custom field. Also since you are storing the comments, at that moment you should also have the information about the user and the time when the approval took place. Please post more information to help us understand.

For general regular expression help, I dont think this is the right forum where you can find help. This is more related to issues related to Nintex product.

Accept as Solution Reply
Workflow Hero

Re: I need regular expression for extracting info from workflow comments

Hi Anu,

It definitely depends on the format of the comments.

With Regular Expressions, you looking at seeing if you can put together a pattern that could match the data you need.

eg.  if the text looked like this

Approver: domain\username

You could put together an expression like:

\w+\\\w+

Or maybe:

Approver: \w+\\\w+

Or even:

(?<=ApproverSmiley Happy\w+\\\w+(?=\n)

It all depends on what you're seeing.

cheers,

Vadim

Accept as Solution Reply
Workflow Hero

Re: I need regular expression for extracting info from workflow comments

It also depends on whether they use Lazy Approval to respond. We can definitely help you for a regular expression pattern, you will find many examples of them throughout the site.

Other things you can use beyond matching strings in a response are references within the workflow

  • Last Task Respondent Display Name
  • Last Task Respondent - returns login
  • All Approver Comments

If you are using a Flexi-Task you can determine the outcome using the Store Outcome In option and put into a variable or by knowing which branch you are in after the response. You can also use the reference Current Time and Current Date in the branches following the outcome of the task to determine the timing. It will be relatively close to the true response. Using these features could be easier than finding the text from a comment for from an email response because of the variations and possible omissions within the responses.

Accept as Solution Reply
Workflow Hero

Re: I need regular expression for extracting info from workflow comments

If you are trying to pull this from the All Approver Comments, Vadim has a good example. But if it needs more tuning, let us know your input string and results from testing. Any details will help to find a perfect match!

Accept as Solution Reply
Workflow Hero

Re: I need regular expression for extracting info from workflow comments

Here are many other examples of using Regular Expressions on Approver Comments Remove approver comments

Accept as Solution Reply
Workflow Hero

Re: I need regular expression for extracting info from workflow comments

You can try your regular expression online.  Ther are various sites that offer sucha service.  I prefer Online .NET Regular Expression Tester and Reference,​ because it is. Net based.

Accept as Solution Reply
Workflow Hero

Re: I need regular expression for extracting info from workflow comments

the input text is like this: Lastname1, Firstname1 (Not Required) 1/7/2016 2:02 PM - Lastname2, Firstname2 (Not Required) 1/7/2016 2:02 PM - Lastname3, Firstname3 (Not Required) 1/7/2016 2:02 PM - Singh, Anu (Approve) 1/7/2016 2:02 PM - 1/7/2016 2:02 PM (Singh, Anu) test From this I need the Name of the person who approved and date and comment. So in the case, I should be able to output Singh, Anu - 1/7/2016 2:02 PM Comment: test.

Accept as Solution Reply
Workflow Hero

Re: I need regular expression for extracting info from workflow comments

Hi Anu,

This should get you started, but be aware that there are many ways to do the same thing with Regular Expression, and by no means proclaim that this expression is the best way:

[\w]+, [\w]+ \(Approve\) \d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{1,2} \w{2}

That should get you :

Singh, Anu (Approve) 1/7/2016 2:02 PM

You can extend this to get the other bits that you want.

Vadim

Accept as Solution Reply
Workflow Hero

Re: I need regular expression for extracting info from workflow comments

This seems to work Anu. I also recommend using the Run Now feature for pre-publish testing. Simply put in the text you supplied here as the input, then add the pattern and run it. If it is coming out well, then do a live test in a workflow for final QA.

Accept as Solution Reply