Hi,
I have a list of fields; name,address,phone number,social security number, and I want to do pattern analysis; Replacing all letters with A, all numbers with 9. I can do pattern analysis on individual fields by applying regex for each. However, I would like to have a single function/formula that can do pattern analysis for all fields. Is it doable or do I need to apply regex for each field
Thanks
Solved! Go to Solution.
regex_replace( regex_replace([_CurrentField_],"\d",'9'),"[[:alpha:]]",'A')
This will replace all digits with the number, '9' and then will replace all alpha characters with the letter 'A'.
Cheers,
Mark
Hi Mark - I am new to Alteryx.
Do you know if there is a function that can rename/replace multiple fields in 1 column through regex.
I tried dynamic rename and replace but cant do it on multiple values in one column. Tried through formula but it didn't work.
REGEX_Replace([Job Title], 'Administrative Support 6', 'Goose') OR
REGEX_Replace([Job Title], 'Technologies 5', 'Geek')
Thanks so much
DD
Could you please clarify how this code works for applying one regex to multiple columns within the Multi-field formula?
regex_replace( regex_replace([_CurrentField_],"\d",'9'),"[[:alpha:]]",'A')
Thank you!
This is a nested expression. The inside expression gets executed first.
regex_replace([_CurrentField_],"\d",'9')
This takes the current field and replaces any digit "\d" with the character "9".
the outer expression then replaces any alpha character [A-Z] or [a-z] with the letter "A".
Cheers,
Mark
@MarqueeCrew Thank you for your reply!
I get this - the sequence of replacements for a specified field. However, how can we use this approach for multiple fields at once?
For example,
Replace(Column 1, ",", "")
Replace(Column 2, ",", "")
Replace(Column 3, ",", "") etc.
Thanks!