ACC Expression Help - String after character | Community
Skip to main content
Level 3
October 23, 2019
Solved

ACC Expression Help - String after character

  • October 23, 2019
  • 2 replies
  • 4075 views

Can anyone tell me the best way in the expression editor to capture the numbers after a specific character.  For example, if the values is 1234-5678.  I want to keep only the characters after the dash(5678).  I tried some of the built in functions but have not had any luck.  Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jonathon_wodnicki

Hi,

Use these built-in functions:

Substring(@field, Charindex(@field, '-') + 1, Length(@field))

Thanks,

-Jon

2 replies

Jonathon_wodnicki
Community Advisor
Jonathon_wodnickiCommunity AdvisorAccepted solution
Community Advisor
October 23, 2019

Hi,

Use these built-in functions:

Substring(@field, Charindex(@field, '-') + 1, Length(@field))

Thanks,

-Jon

September 17, 2021

Hi @jonathon_wodnicki - Following on this question, as we have a similar but more complex requirement. We can have the string as 1234-5678-abcd or 1234-5678-abcd-0101

The text can increase in the right, and out objective is to find the text everything before the last dash, e.g. 1234-5678, or, 1234-5678-abcd

 

Any suggestions to resolve this using built-in functions in the Enrichment activity?

 

Thanks
Dheeraj

wpomeroyAuthor
Level 3
October 23, 2019

This worked perfectly, thank you.  My understanding of the way Substring worked was not correct.