Start Free Trial

Alteryx Designer Desktop Discussions

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

Formula tool | Replace

Sarath27
8 - Asteroid

ABC_L1_200

ABC_DB_2020

ABC_A_202

 

So basically this field has _, alpabhates along with_, _along with AlphaNumeric. But the end result should be below

ABC_200 - Removed Alphanumeric

ABC_2020 - Removed Hyphen along with Alphabet(s).

ABC_202 - Removed Hyphen along with Alphabets

 

Please kindly advice me to write formula to achieve this.

3 REPLIES 3
IraWatt
17 - Castor
17 - Castor

Hey @Sarath27,

I'd recomend to use Regex to parse the unwanted text then remove with a formula:

IraWatt_1-1653655699241.png

I used this regex:

 

_(\w+_)

 

Check out regex101: build, test, and debug regex for more information on how it works :)

Any questions or issues please ask! 
HTH,
Ira

Ladarthure
14 - Magnetar
14 - Magnetar

Hi @Sarath27,

 

there are multiple ways to do it, if I understand well, it's about removing the part in the middle and keep first and last part:

  • Use a formula Regex_Replace([field], '(.+)_(.+)_(.+)', '$1_$3')
  • it will keep the first and third marked group but it needs to have an _ as a separator
  • You could also use a text to columns, set the delimiter as "_" and then combine the colones 1 and 3 you got from using this tool.
binu_acs
21 - Polaris

@Sarath27 one way of doing this

 

binuacs_0-1653655852149.png

 

Labels
Top Solution Authors