I am trying to remove the FIRST occurrence of a parenthesis in a string. Here is my input text:
Douglas Christopher W) I have some (comments) to add.
Using RegEx, I can use the Pattern \)
And the Replacement Text :
But that will change ALL the occurrences of the ) character, returning
Douglas Christopher W: I have some (comments: to add.
How do I turn off the global flag and just convert the first instance?
The Nintex Regular expression action uses .NET regular expression format.
There does not appear to be a way to turn of the /g global flag and that is why the regex matches all occurances and does not adhere to being lazy.
I was able to come up with a long and tedious workaround that does work.
First I use the regular expression ^[\w\s]+\) that will find everything up to the first closing parentheses.
Extract that into its own collection variable. Then use the same expression to replace that text with blank and put that into its own text vaiable.
Extract the the first part of the string from the collection and use a replace to alter the closing parentheses to a colon then use a build string to join the two halves back together again.
I have attached a sample workflow. You could put all of this into a UDA or action set.