So i have a string that has no spaces, but each word in the string is capitalized. For example the string could contain "JohnTonySmith" and I would like to be able to add a space before the capital letters so that it turns into "John Tony Smith" is this possible to do with regex in Quick Fields?
Question
Question
Replies
Hi Joshua,
I think you can accomplish this with a series of regular expressions. At least if the strings have a consistent number of words. The expressions would look like this, to break it down. Then you could put it back together with the spaces.
([A-Z].*)[A-Z].*[A-Z].*
[A-Z].*([A-Z].*)[A-Z].*
[A-Z].*[A-Z].*([A-Z].*)
Regex only works with existing data, so as such it can't add to it. But check out the Substitution process which allows you to use regex to break up your string into "John", "Tony", "Smith" and then built it back up from the 3 values with space using match groups.
If you have substitution, you can create a substitution rule for each letter A-Z. So "A" is replaced with " A", etc. Mack sure to check the box to match case and the box to replace the input with the result.
In my sample, I just do the 3 letters of your sample name
The data is in a barcode that is read into token %(Barcode 1) by my QF session. Then after I run the substitution on that token, to use the token data, apply a trim function.