Remove leading zero, space and dash in existing column and return the output in new column

syazwaan
syazwaan New Altair Community Member
edited November 2024 in Community Q&A
I have a dataset something like this:

I want to remove leading zero, space, and dash in column_1 and return the new data in a new column.

Expected output:


Thank you.
Tagged:

Best Answer

  • BalazsBaranyRM
    BalazsBaranyRM New Altair Community Member
    Answer ✓
    Hi!

    The easiest way to do this is Generate Attributes with the replaceAll function.

    It takes three parameters: The name of the attribute to read (column_1), the regular expression to search for, and the replacement (the empty string "").
    A regular expression to find leading spaces, zeros and dashes would be this: ^[0 -]+

    Regards,
    Balázs

Answers

  • BalazsBaranyRM
    BalazsBaranyRM New Altair Community Member
    Answer ✓
    Hi!

    The easiest way to do this is Generate Attributes with the replaceAll function.

    It takes three parameters: The name of the attribute to read (column_1), the regular expression to search for, and the replacement (the empty string "").
    A regular expression to find leading spaces, zeros and dashes would be this: ^[0 -]+

    Regards,
    Balázs