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)
Thank you for the reply 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. @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,"{.*?}","")
@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