Ready for Dataiku 10? Try out the Crash Course on new features!GET STARTED

Removing only first character that appear multiple times in a string

Solved!
Aminmin
Level 1
Removing only first character that appear multiple times in a string

Hi there, I am trying to remove the FIRST apostrophe in a string. There are also data that has apostrophe in the middle of the string which i do not want to remove eg. in '1234 output should be 1234. In '12'34 the 2nd ' should remain, output should be 12'34. Using Prepare, Replace ' --> No value will also replace the ' that is not the first character. Pls advise what I should do. Thank you

0 Kudos
1 Solution
AlexT
Dataiker
Dataiker

Hi @Aminmin ,

If you use the existing Replace processor in the prepare recipe with a small modification e.g

Use Regular Expression matching mode and provide the correct regex:  ^'

^  is simply the "start of string" in regex : 

Screenshot 2021-10-29 at 13.13.14.png

Let me know if this is what you were looking for.

View solution in original post

0 Kudos
2 Replies
AlexT
Dataiker
Dataiker

Hi @Aminmin ,

If you use the existing Replace processor in the prepare recipe with a small modification e.g

Use Regular Expression matching mode and provide the correct regex:  ^'

^  is simply the "start of string" in regex : 

Screenshot 2021-10-29 at 13.13.14.png

Let me know if this is what you were looking for.

View solution in original post

0 Kudos
Aminmin
Level 1
Author

Hi AlexT, greatly appreciate your kind reply. I believe this works for me. Thanks!!

0 Kudos
A banner prompting to get Dataiku DSS