community
cancel
Showing results for 
Search instead for 
Did you mean: 
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Weekly Challenge
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Unable to display your progress at this time. Please try again a little later, or contact an administrator if you continue to see this error.

Challenge #130: Is There an Echo in Here?

Sr. Learning Strategy Manager
Sr. Learning Strategy Manager

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!)

 

Cat_matrix_deja_vu.gifDeja Vu anyone anyone?

 

Asteroid

Good post! Cheers!

Quasar

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

 

APL.png

Spoiler
Solution 130.png

 

Dan

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

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

 

Bolide
Bolide

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!

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
Meteor

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

 

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

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

1 tool solution...

Asteroid

Thank you for the challenge