Alteryx Designer Desktop Discussions

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

Using RegEx to remove a word & numbers at the end of a string

dmpope
8 - Asteroid

Hi there,

 

So I have a set of data with "CONG ###" at the end of each string. I was trying to use RegEx to remove those instances but I'm having trouble coming up with the right combination to remove it. It will always be the last 7 characters of the string. I've tried:

 

<\CONG (which only got rid of the word, but nothing after it)

<\CONG* (which only got rid of the word, but nothing after it)

<\CONG*\> (which only got rid of the word, but nothing after it)

<\CONG*$ (which didn't work at all)

\<\CONG+\ (which only got rid of the word, but nothing after it)

And <\CONG+\> (which only got rid of the word, but nothing after it)

 

Would someone be able to help me out?

 

Thanks!

4 REPLIES 4
DanielG
12 - Quasar

@dmpope Try this:

 

CONG.{3}

 

DanielG
12 - Quasar

DanielG_0-1677689545236.png

 

dmpope
8 - Asteroid

Hi Daniel,

 

That didn't work unfortunately. That didn't remove the CONG or the numbers after it. 

 

**EDIT: apologies, there was user error there, I was using [ ] instead of { }. This does solve my problem.

 

Thanks!

DanielG
12 - Quasar

@dmpope Awesome.  Glad it worked.  FYI - Not sure if you use sites like this but for me the best way to test Regex is with something like https://regexr.com/ or https://rubular.com/

 

Just dont paste sensitive data in there...  ðŸ˜€

Labels
Top Solution Authors