Solved

Remove guids from string using regex

  • 22 January 2024
  • 1 reply
  • 29 views

Badge +9

I am trying to use workflow to migrate values from a managed metadata column to a choice column. How can I keep the labels and replace everything else with ;#. ?

 

Input string: 

Buying Agent|a77795cc-c97a-4965-ad6c-099ee89d8f66;Accounts Manager|a831fa17-5cd2-47ae-964a-bfbf283df5ac;Reports Role|5e80eaaa-14be-4e95-998f-52c025ed286a;View Role|689cc436-5b04-4497-bf2c-93fc8b845666;Orders|a4ae04d9-f1f8-4204-bb6f-15bcdf8c2d62;Vendor Invoices|5cd3e02e-e7ce-42e6-a084-1d77c3d39683

(no semicolon at the end)

 

Desired output string:

Buying Agent;#Accounts Manager;#Reports Role;#View Role;#Orders;#Vendor Invoices

icon

Best answer by MegaJerk 23 January 2024, 20:07

View original

1 reply

Userlevel 5
Badge +14

Assuming that your guids never have uppercase letters as you’ve shown there, then the following should work: 

\|[a-z0-9\-]*\;?

 

Example:

Note however that this adds a “;#” to the end of the output string, which will likely result in an empty value at the end of a collection. You’ll need to run this string through another regex action to remove that last delimiter. 

 

so, the regex will be:

\;\#(?=$)

 

with results:

 

Reply