How to remove letters/chars preceding last '-' in a string

Solved!
Aminmin
Level 3
How to remove letters/chars preceding last '-' in a string

Hi all, i have a column comprising of text of letters and characters followed by country name -> SC/K-UGANDA, SN/KG-AMERICA,TT-NG-PERU ......etc. I only want to populate the country name.

Please advise how i can do this using recipe in DataIKU or what step/code can i add.

Thank you for your kind attention and advice.

Regards

Aminmin


Operating system used: IOS

0 Kudos
1 Solution
Jurre
Level 5

That's what i like about this application : options to discover ๐Ÿ™‚ thanks for the tip @Manuel 

another option would be splitting the column on '-'and truncating the outcome to the last occurance of that '-'. or the last two if '-'-containing countries  is a concern.

cheers!

 

View solution in original post

4 Replies
Manuel
Dataiker Alumni

Hi,

In a Prepare recipe, add a "Extract with Regular Expression" processor and then use the Smart Pattern Builder.

 

I hope this helps.

 

Aminmin
Level 3
Author

Hi Manuel, thanks for the tip. But i am not able to find the Smart Pattern Builder. Maybe mine is a lower version. However, really appreciate your kind advise as i now know the existence of this builder. Thank you and have a great weekend!

0 Kudos
Jurre
Level 5

That's what i like about this application : options to discover ๐Ÿ™‚ thanks for the tip @Manuel 

another option would be splitting the column on '-'and truncating the outcome to the last occurance of that '-'. or the last two if '-'-containing countries  is a concern.

cheers!

 

Aminmin
Level 3
Author

Hi Jurre, greatly appreciate your prompt reply. Your solution works for me...Have a great weekend!!