Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

replace the string

luo
8 - Asteroid

Hi all, 

 

I have a very trick problem to replace some part of the order number in this table

 

beforeafter
2SCP6TVU2SCP6TVU
3UIOV8SC3UIOV8SC
3UIOV8SCSCR3UIOV8SC
2PJHQ5MCSC2PJHQ5MC
2PJHQ5MCSCR2PJHQ5MC
2NURAQHCSCRSC2NURAQHC
EYA1800027061SCEYA1800027061
EYA1800027061SCR

EYA1800027061

 

I need to remove the SC or SCR or SC- in the string. but only in the ending part of the data. If SC is in the middle of the string, then don't remove like row 1. But the number of the SC or SCR is not certain. Maybe there will be like SCRSC- or SCSCR or SCSCRSC or SCSCRSCSCR. But all the SC, SCR, SC- are in the ending part. However, sometimes the data may end with SC like row 2, don't remove it.  so another information is that order number is only in 8 or 13 digit. This is very complicated. Thank you guys. 

 

 

 

3 REPLIES 3
mceleavey
17 - Castor
17 - Castor

Hi @luo ,

 

I did this using a cheeky bit of regex:

 

SC$|SCR$|SC-$

 

mceleavey_0-1621602540852.png

 

Hope this helps,

 

M.

 



Bulien

MarqueeCrew
20 - Arcturus
20 - Arcturus

Hi @mceleavey ,

 

I like your solution but wanted to add....

 

SC\b|SCR\b|SC-\b

 

looks for boundaries at the end of the "word" as an alternative.  this technique is useful if multiple words could exist in a field.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
mceleavey
17 - Castor
17 - Castor

Good point, @MarqueeCrew 



Bulien

Labels