I am new to workflow - how do I use regular expressions to change a Template Value? I have most SSN with dash but thousands without and want to make all with dash.
Question
Question
Replies
I address this first using the Pattern Matching activity to strip out the hyphens that are sometimes there, sometimes not.
Then use an Assign Token Values activity with the Token Editor to set formatting with the hyphens.
Assuming all of your values are currently 9 digits long either with or without hyphens (or periods or spaces, etc.), this will successfully add the hyphens to all values. If you have values that are less than 9 digits, you'll see them pre-fill zeros (like 000-00-1234), and if you have values that are more than 9 digits, you'll see them with too many digits before the first zero (like 123456-78-9012). You may want to do a conditional sequence or something if there is a possibility of not being 9 digits. Maybe something like this (which checks for either 123456789 or 123-45-6789 format).
Alternately, if you only want to get the values that are missing the hyphens, use the Conditional Sequence checking for the [0-9]{9}. Then you only need to do the Assign Token Values activity with the formatting.
Bottom-line, lots of options...