Regex expression to remove some text from Query output

Please how can I remove {color:#de350b} and {color} from:

{color:#de350b}FA_RDA_CORE-DEC-20220325122114-210-981{color}

to get

FA_RDA_CORE-DEC-20220325122114-210-981

Hi @samson_Omolola

Welcome to UiPath community

You can try with Regex Expression

YourString = "{color:#de350b}FA_RDA_CORE-DEC-20220325122114-210-981{color}"

Use Assign activity

StrVal = System.Text.RegularExpressions.Regex.Match(YourString,"(?<=})\S+(?={)").Tostring

image

Regards
Gokul

As an opposite of grabbing we can use regex replace as alternate option


replacing with empty string
grafik

strPattern = "{[\s\S]+?}"
 System.Text.RegularExpressions.Regex.Replace(strText, strPattern,"")

Thanks, it worked

@samson_Omolola
Perfect, it is working. May we ask you for the following?

thanks for support

Thanks, question answered.