We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Inconsistent Regex Behaviour

corkddd
5 - Atom

Hello all,

 

I've noticed some strange regex behaviour in Alteryx, namely when using capture groups as compared to regex101. Please see the screenshots below:

 

Using this formula

 

 

REGEX_Match([test], "(h)")

 

 

 

In Alteryx:

 

alteryx comm 1.jpg

In Regex101:

 

image.png

 

Alteryx does not seem to be picking up anything except for JUST "h". I found an easy workaround by using the following regular expression, which does work in Alteryx: 

 

 

.*(h).*

 

 

But the question still stands, why is Alteryx inconsistent with Regex101? I thought it may have something to do with flags but I'm not sure if that's the case.

 


For context:

  • I'm using version 2020.2
  • AMP engine is off

 

Thanks in advance for any help!

2 REPLIES 2
cmcclellan
14 - Magnetar

OMG! I had this exact problem this morning - admittedly I was writing Python (not using Alteryx) but it's the same thing.  I found this:'

 

https://stackoverflow.com/questions/180986/what-is-the-difference-between-re-search-and-re-match

 

but in your case, this is more appropriate:

 

https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Regex-match/td-p/434001  (the last line states: If appears that Regex_Match has to match the entire field in order to return true, whereas Regex_replace acts on any part of the field.  )

 

I just can't get regex101 to replicate what I was doing.  

 

The solution is really:

REGEX_Match([test], ".*(h).*")
flying008
15 - Aurora

Hi, @corkddd 

 

In Alteryx, use REGEX_Match function to must be match the entire field.

In RegEx101, just match any-part of string.

Labels
Top Solution Authors