Removing only first character that appear multiple times in a string

Aminmin
Aminmin Dataiku DSS Core Designer, Registered Posts: 18 ✭✭✭✭

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

Best Answer

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,226 Dataiker
    Answer ✓

    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.

Answers

Setup Info
    Tags
      Help me…