Need ETL formula to extract numeric ID from campaign name

Hello - does anyone know how to write an ETL formula to extract the numeric ID at the end of this campaign name: Display_Retargeting Package_07/09/24-12/31/24_BA:4114356 so that I can get a new column with just the campaign ID (numeric string at the end of the campaign name 4114356?

Thank you so so much for any help!

Best Answer

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    You can either use SPLIT_PART or a regular expression:

    SPLIT_PART(`field`, ':', 2)
    
    REGEX_REPLACE(`field`, '^.*(\d+)$', '$1)
    

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**

Answers

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    You can either use SPLIT_PART or a regular expression:

    SPLIT_PART(`field`, ':', 2)
    
    REGEX_REPLACE(`field`, '^.*(\d+)$', '$1)
    

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**