Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Regx

anupgupta12
8 - Asteroid

Can someone explain highlighted portion of below reg expression?

 

 Input -          It's going to be great great day   output - It's going to be great day

 

\b(\w+)\s\1\b

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

_

atcodedog05
22 - Nova
22 - Nova

Hi @anupgupta12 

 

I got it. Thought i remember it from somewhere. The expression should be something like this.

 

 

REGEX_Replace([Field1], "(\b\w+\b)\s\1", "$1")

 

 

Workflow:

atcodedog05_1-1627058680731.png

 

\b - word wrap

\w+ - word

\b - word wrap

\s - space

\1 - same word as in bracket

 

Basically, if a word is repeated it reduces to one.

 

Hope this helps : )

anupgupta12
8 - Asteroid

How did you come to know \b means word wrap, i don't see it in regex. Can you please tell me?

atcodedog05
22 - Nova
22 - Nova

Hi @anupgupta12 

 

Agreed its not there in the Regex tool's list. There are lot which can be used which is not there in the list. Refer this website>cheatsheet section it will give you idea about regex usages. Regex is mostly common across lot of languages.

https://regexr.com/

 

atcodedog05_0-1627110320352.png

 

Hope this helps : )

Labels
Top Solution Authors