Hi,
I'm searching for a similar REGEX that remove the letter(s)/number(s) at the end of a string only if the digit is the same than the second group of the string.
Exemple :
100 10 RUE DES SAPINS RIMOUSKI 10
22 BOUL PRAIRIES QUEBEC
34 4 AV DE LA MOUTARDE 4
22 PO BOX 44
122 B 10E RUE CHIBAUGAMEAU B
Result :
Remove the 10 at the end of the first line
Remove the 4 at the end if the 3rd line
Remove the B at the end of the 4th line
I'm new with Alteryx and it could help me so much.
Thank you in advance ✌️
Solved! Go to Solution.
Hi, @Billibo418
If you want to retain the last space, then remove the Trim funcion in Formula:
Trim(REGEX_Replace([Txt], "^(.+?\s)([[:alnum:]]+?)(\s.+)\2$", "$1$2$3"))
****
If it help you get your want output, please mark it as s solution and give a like for more share.
getword([txt],1) is the second word.
TrimRight([txt]," "+getword([txt],1)) should do the trick.
cheers,
mark
Hi, @MarqueeCrew
Yep ! If have a string like "22 PO 4 AV LA 4" or want remove first repeat word, the RegEx will show flexible compatibility.
flying008 : Works perfectly !
Thank you so much
Cheers,