Alteryx Designer Desktop Discussions

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

Regex expression help

Voska
8 - Asteroid

I'm new to Regex expressions and wondering if its even possible to get one to do what i want.  Say i have a string: '2332433Reason:this was not approved'  And assume there are hundreds of rows and maybe only half of them actually have the Reason: part in it.  I'm hoping to use replace in the Regex to turn the column into just 'Reason: this was not approved' 

 

Something similar to this:

RTRIM(LTRIM(SUBSTRING(Reason_Change_Content, CHARINDEX('Reason:', Reason_Change_Content), LEN(Reason_Change_Content))))

 

If this is possible can someone tell me how to write the regular expression and replacement text?

 

Thanks

3 REPLIES 3
Voska
8 - Asteroid

Never mind, i just realized there was a typo causing it.  For anyone else that might be looking for a similar answer... seems you can do something as easy as this:

 

Regular expression: Reason:(.*)

Replacement Text: $1

 

Treyson
13 - Pulsar
13 - Pulsar

For anyone else looking for Regex help, I find this website to be awesome!

 

http://regexr.com/

Treyson Marks
Senior Analytics Engineer
SeanAdams
17 - Castor
17 - Castor

:-) another great one is http://regex101.com

 

Like the site recommended by @Treyson - both allow you to practice and get outcomes in real-time - with explanations etc.

 

Labels