Start Free Trial

Alteryx Designer Desktop Discussions

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

regex formula for testing

Chaoued
7 - Meteor

I wanted to replace any value except (A1,A2,A3 and A6)

 

Input : 

A1,A2,R4,E3
A1,A2,A2
B2,C1,A1

 

Output :

A1,A2
A1,A2,A2
A1

 

This formula doesn't work

--> REGEX_Replace([field], "\\b(?!A1|A2|A3|A4|A6)\\w+\\b","")

 

Thanks for your help

4 REPLIES 4
Chaoued
7 - Meteor

This is work for me : REGEX_Replace([field], "A1|A2|A3|A4|A6|,","")

any other solutions ?

DataNath
17 - Castor
17 - Castor

Hey @Chaoued, you can clean REGEX_Replace([field], "A1|A2|A3|A4|A6|,","") up a bit by just using:

 

REGEX_Replace([field], "A[1-46],","")

Chaoued
7 - Meteor

@DataNath With your formula, it will keep A1 in this exemple B2,C1,A1, and i want to keep Only B2,C1,

DataNath
17 - Castor
17 - Castor

Ah sorry, pasted the wrong expression! I had this:

 

Trim(REGEX_Replace([Input], "A[1-46]",""),",")

Labels
Top Solution Authors