Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #130: Is There an Echo in Here?

JoeM
Alteryx Alumni (Retired)

You have a source system that doesn't seem to be working quite as expected. The system will frequently take any given word and duplicate it within a string. You job is to clean it up! Below we have a few sample phrases that are indicative of the system's problem. Find all words that have duplicate consecutive words and reduce the duplication to a single word again!

(Advanced Users: There is a one tool solution for this!)

 

Deja Vu anyone anyone?Deja Vu anyone anyone?

 

JoBen
11 - Bolide

Good post! Cheers!

danilang
19 - Altair
19 - Altair

The power in that one tool!  Even if the syntax is almost as convoluted as APL

 

APL.png

Spoiler
Solution 130.png

 

Dan

danrh
13 - Pulsar
Spoiler
I'm not sure how I survived before I discovered RegEx...

REGEX_Replace([Phrase], '(^|[ ])(.*) (\2)', '$1$2')

 

ggruccio
ACE Emeritus
ACE Emeritus

Will have to look at those one-tool solutions - Impressive!

 

For this one I had an immediate idea to solve it a certain way --- which worked!

patrick_digan
17 - Castor
17 - Castor

Here is my 1 tool solution. 

Spoiler
Isn't it funny how we're all accomplishing the same thing but our regex expressions are slightly different and will handle new data slightly differently....

Capture.PNG
brgilbert
7 - Meteor

Learning RegEx so it's helpful to see examples of how it all works.  

 

Spoiler
REGEX_Replace([Phrase], '(^|\s)(.*) (\2)', "$1$2")
mpennington
11 - Bolide

Solution attached.

 

Spoiler
Always a bit of trial and error for me to make these RegEx patterns work, but I think I got it.  MP 130.jpg
OldDogNewTricks
10 - Fireball

1 tool solution...

papalow
8 - Asteroid

Thank you for the challenge