Using RegEx to replace data

HI all

Please can I ask for help writing a regex and then using it in the Matches function in Ui path

In the example below I need to replace the text in between the curly brackets and the brackets themselves with nothing

173.682.67 648364 {grid reference 2} {amount to allocate 2} {grid reference 3} {amount to allocate 3}

So the final result would be 173.682.67 648364 (out of interest the 173.682.67 is the ‘grid reference’ and the ‘648364’ is the amount to allocate)

The reason is because I have to paste the data in to a programme as part of my build and if there are no grid reference/amount to allocate values then the business require that nothing is presented (hence the need for the RegEx help)

Thanks in advance

Hi @jordrowley

use this for allocate


Use this for grid reference



Thank you for the reply :slight_smile: I can see that’ll find the values for ‘allocate’ and ‘grid reference’; do you know how I replace the text in the curly brackets with nothing, i.e ‘delete’ the data from them (along with the brackets themselves)


use the regex replace “{.*}” for “” to remove everyting from the first { to the last }
this won’t work if you have cases like 191.202.23 65060 {text1} {text11} 1919.22 2929 {text2} {text22}
because then it will remove the numbers as well


@tbrinkman, you almost reached the solution. :+1:
@jordrowley, I hope this pattern {.*?} will meet your requirement.
If you would like to replace the contents in between the curly brackets,
Please assign String_Var =System.Text.RegularExpressions.Regex.Replace(Your_String,"{.*?}","")

Warm Regards,
NImin :slightly_smiling_face:


@tbrinkman @nimin thanks both for the answers. Your RegEx works really well, nimin, thank you. Thanks for the assign advice too - I didn’t have a clue about that bit. Not tried it yet, but I’ll let you know if I have any problems with it :slight_smile:

Thanks again

1 Like

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