In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

RegEx replace 3 character string with blank

shelbyswartz
6 - Meteoroid

I am trying to use Regex to recognize the strings with 3 characters and replace them with nothing. Example,"IDC". What would be the syntax for this?

5 REPLIES 5
Luke_C
17 - Castor
17 - Castor

Hi @shelbyswartz 

 

Assuming you want to replace any instance of IDC and leave the rest of the string intact: In a formula tool, something like REGEX_Replace([Field1], 'IDC', '') should work. In the regex tool the below screenshot's configuration will do the same thing as the above formula. 

 

A non-regex solution would be: replace([Field1],'IDC','')

 

Luke_C_0-1620944986904.png

 

shelbyswartz
6 - Meteoroid

I actually need to identify any string that's 3 characters and not just IDC.

Luke_C
17 - Castor
17 - Castor

Ah, sorry I misread. Is there any reason you want to use regex rather than a formula like the one below that checks the length? 

 

if Length([Field1]) = 3 then '' else [Field1] endif

 

apathetichell
20 - Arcturus

 

This is a length of 3 or 3 letters in a string of numbers?

 

If the latter than:

if REGEX_Match([test],".*[a-z]{3}.*") then "" else [test] endif will work for you.

 

if more than 3 is an option {3} should be {3,}

 

shelbyswartz
6 - Meteoroid

Thanks Luke!

Labels
Top Solution Authors