Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

OR-ing together REGEX_REPLACE

theinsideguy
7 - Meteor

Hello,

 

This is a pretty simple problem to explain, and I was hoping someone can explain why this doesn't work. I have a bunch of regular expressions I'm trying to use regex_replace in the formula tool, as so:

 

Regex_replace([text], "regex expression 1", "replacement 1") OR

Regex_replace([text],"regex expression 2", "replacement 2")

 

However, regardless of what I put in the regex expression or replacement fields (it can be the simplest thing), all I get is "0" in the text column (which is a vstring). The only way around this is to make it a two step process and do a "if regex_match then regex_replace" type thing which requires two operations instead of one (this is going to be performed on millions of records, so speed is important). 

 

Any guesses to why sticking the logical OR sign causes this to happen? 

2 REPLIES 2
flying008
14 - Magnetar

Hi, @theinsideguy 

 

anyway, your formula Regex_replace([text], "regex expression 1", "replacement 1") OR Regex_replace([text],"regex expression 2", "replacement 2") only is a logic expression about "OR", so the result just is 0 or -1 .

If you want used both regex expressions, maybe you need REGEX_Match(String, pattern) first.

grazitti_sapna
17 - Castor

@theinsideguy , can you provide a sample dataset?

Also, if you could try this.

 

grazitti_sapna_0-1656654795135.png

 

Another way around is to break the formula 

Regex_replace([text], "regex expression 1", "replacement 1") OR

Regex_replace([text],"regex expression 2", "replacement 2")

into two different field.

 

Thanks!

Sapna Gupta
Labels