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 formula for testing

Chaoued
8 - Asteroid

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
8 - Asteroid

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
8 - Asteroid

@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