Alteryx Designer Desktop Discussions

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

Reg ex tool not recognizing positive lookbehind

Eva
6 - Meteoroid

I am trying to use positive lookbehind in the RegEx tool to capture beginning of a string among other things. It looks like the part that is giving me an error is the part of the expression that is looking for the beginning of the string. I have tested the expression on two different RegEx pages online and it works. Why is Alteryx giving me an error?

 

I have attached a simple workflow that has some example data and that also shows where the error occurs.

 

Can someone please help? What is wrong with the expression?

4 REPLIES 4
cmcclellan
13 - Pulsar

Hi @Eva 

 

I think it was getting confused with the ^| meaning at the start of the string there's "nothing" option.

 

I usually use https://regex101.com/ and change the flavor to Python.  I did this and changed your regex slightly and I get this 

 

 
 

2024-05-13 01_30_55-Alteryx Designer x64 - RegEx error.yxmd.png

 

Hopefully that helps ::)

Eva
6 - Meteoroid

Thank you for the quick reply. Unfortunately it does not really capture the problem. The change to the rex ex that you suggested kind of changed the syntax of what I want to capture. If you compare the expected values to the result you see that record 13 is wrongly included in the result.

 

The main part of the string that I want to capture has the syntax of “3 characters within A-Z followed by 5 to 7 digits”. That should be ok with this reg ex: [A-Z]{3}\d{5,7}

 

That main part must either be the start of the string or be preceded by either a slash, a dash or an underscore.

 

The main part can then be followed by either nothing, i.e. be the end of the string, or another slash.

 

What would the reg ex be to describe that and that also works in Alteryx? The reg ex I have works on both https://regexr.com and https://regex101.com but not in Alteryx.

flying008
14 - Magnetar

Hi, @Eva 

 

Hi, I also found a similar problem a long time ago, we use a syntax that passes fine on RegEx101.com, but not in Alteryx, the reason is that it uses a simple parsing pattern, I now use a workaround syntax to get around this problem, and it works.

FYI:

(?:^|\/|-|_)([A-Z]{3}\d{5,7})(?=\/|$)

 

Eva
6 - Meteoroid

Thank you flying008. That worked. 😀

Labels