I need to replace the word “TBD6” to the corresponding Service ID, I have an idea of using Replace, but I don’t know how to figure it out. Thanks
Example Message :
“You’re now registered to TESTRPA1. <ABCD_EFGH_IJKLM_MB_TBD6>.”
Upon getting the equivalent service id of TBD6(which is 6666), the new message will be:
“You’re now registered to TESTRPA1. <ABCD_EFGH_IJKLM_MB_6666>.”
what you can do is to use an input dialog to request the user to key in a value, store it as a string lets say variable1 and the in lookup value change “TBD6” to “TBD” + variable1. this should help u look up different values but do remember to set a flow decision to ensure no one keys outside of the expected value range.
wildcards only applies to selectors if i’m not wrong, i don’t think there is a way unless u prompt the user to key in the value since you don’t know what values they will key in
You can use regex replace instead of string replace to match a pattern - then you can match “TBD” followed by a single number.
To use regex replace you need to import the System.Text.RegularExpressions library in the imports tab of the workflow.
It would look like:
yourNewString = Regex.Replace(yourInputString, “TBD[0-9]{1}”, yourReplacementString)
The pattern says - match the characters TBD exactly, then match a single character which is between 0 and 9.
Have a look at RegExr to see how different patterns impact the result, and for a pattern cheat sheet - for example, if you use “TBD[0-9]{1}$” instead, it will only match the pattern if it’s at the end of the string.