Formatting flexi task comments with regular expression

  • 7 August 2018
  • 7 replies
  • 18 views

Badge +4

Hi All

Hope someone can help me, as I'm struggling with regular expressions. (Nintex on premises, SharePoint 2013).

In my workflow I have a flexi task which asks a Reviewer to choose an outcome and add a comment. I then have a 'Set field value' control to update these comments on the original form:

workflow

This adds the comments to the form in the following format, which looks rather messy and difficult to read:

Lastname, Firstname (Outcome) Date Timestamp - Date Timestamp (Lastname, Firstname) Comments

I would like the above to look like this:

Lastname, Firstname (Outcome) Date Timestamp:
Comments

I've tried using the regular expression, with guidance from this remove approver comments thread, but I'm stuck.

I tried the following pattern but when I run it, the result is the same as the input text

s[w-]*s[w-]*s(NotsRequired).*

Can anyone help with the correct expression or highlight what I'm doing wrong?

Thanks

Sean


7 replies

Badge +4

Can anyone please assist?

Badge +16

I normally remove the task comments field and add a comments field from my SharePoint list by customizing the task form - that way you get the raw comments and none of that added stuff.

Badge +4

Hi Cassy

Thanks for the reply. Yes I've used that option before but in this case I would like to use the Approver task comments because they display the metadata (as in approver name and timestamp etc) on the form field.

Using the other option is neat but doesn't show the metadata on the form (although you can find it from the workflow history).

Badge +16

OK then in that case I will tag Marian Hatala‌ the master of all things regular expression happy.png

Userlevel 5
Badge +14

there are several threads in the forum that ask the same - use the search  https://community.nintex.com/search.jspa?q=%22approver+comment%22+regular+expression 

here is eg. quite long thread where there are discussed plenty of simple or complex regular expressions, none of them, however, can be taken as a general solution

Remove approver comments 

I'd focus you on these my old posts

https://community.nintex.com/message/30631?commentID=30631#comment-30631 

https://community.nintex.com/message/75348-re-extracting-data-from-approver-comment?commentID=75348#comment-75348 

Badge +4

Hi Marian

Thanks for the reply. Actually I read thoroughly through all of those posts before I posting mine, as I am still stuck.

The closest one I could see was the post by Stephen Parker, however it mentions creating loops. 

I just thought there would be some simple reg ex to achieve what I'm after i.e. 

"Lastname, Firstname (Outcome) Date Timestamp:
Comments"

Thanks

Userlevel 5
Badge +14

Actually I read thoroughly through all of those posts before I posting mine

hadn't you still get convinced regexes are not a proper way to go for this purpose? laugh.png

however it mentions creating loops.

yes, because he splits outcome into two parts and stores it into a collection. so he has to iterate over collection to process each part separately

I just thought there would be some simple reg ex to achieve what I'm after

if you have read through the forum as you mentioned, you might have noticed there is no such simple one.

I tried the following pattern but when I run it, the result is the same as the input text

if you test with Ron Now you have to supply some real Input Text sample. in Run Now reference variable can not be evaluated and is taken literally.

the other reason you do get returned whole input is that with your regular expression you require " (Not Required)" string being present, which is apparently not the case.

considering sample of possible input you provided and expected output, eg. following regular expression might work

s-sd{1,2}/d{1,2}/d{4}sd{1,2}:d{1,2}s(A|P)Ms(.*)s

219116_pastedImage_11.png

Reply