Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Regex Error (but okay in Regex101)

Bobbins
8 - Asteroid

Hello,

Text String;

"The very Blue Sea is always blue unless its orange when its not BLUE sea"

The idea is to split on every "blue" regardless of case to give:

The veryBlue Sea is alwaysblue unless its orange when its notBLUE sea


This works in Reg101 but not in Regex as to parse it gives the error: "Error: Nothing to parse. Enter a complete expression."

Code is:
(?i)\s+(?=\bblue\b)

Thank you

16 REPLIES 16
atcodedog05
22 - Nova
22 - Nova

Hi @Bobbins 

 

Reg101 doesn't handle parse hence you are getting this issue in Alteryx.

 

Hope this helps : )

atcodedog05
22 - Nova
22 - Nova

Hi @Bobbins 

 

Here is how you can achieve the same

 

atcodedog05_0-1643133222697.png

 

Hope this helps : )

 

Bobbins
8 - Asteroid

Thanks thats one way to solve it, can you use Regex to do the same so i can keep the case of what i am breaking  up?

atcodedog05
22 - Nova
22 - Nova

Hi @Bobbins 

 

In your scenario you are breaking on n number of blues and also first column doesn't have blues hence its bit tricky.

 

@PhilipMannering do you have any suggestions on this.

 

Hope this helps : )

 

 

apathetichell
19 - Altair

What you are doing is tokenizing since you are taking one column and splitting it into multiple components. Alteryx tokenizing supports exactly 1 marked group. You have two marked groups - hence this is not doable in Alteryx.

 

On a purely matched group process - you can see that you have 3 matched groups if you use:

REGEX_CountMatches([Field1],"(?i)\s+(?=\bblue\b)")

 

I would also note - that regex 101 gives you match information (ie the number of matches) but it does not show you the values of those matches (like you would expect to see from a succesful Regex tokenizing) see the difference between your expression and say:

(\s\w+\s)

 

where every match in Regex 101 also returns a group.

 

apathetichell
19 - Altair

I've attached the way to split with case...

 

The key is tokenize the words, use a multi-row formula to index them by Blue (with a normalized case) and then concatenate in crosstab.

Bobbins
8 - Asteroid

Thank you kindly, thats a different way to how i was thinking it could be done!

Bobbins
8 - Asteroid

@atcodedog05 Thank you also for your help :-)

atcodedog05
22 - Nova
22 - Nova

Just curious wouldnt my approach also work.

 

Happy to help : ) @Bobbins 

Cheers and have a nice day!

Labels