Expand my Community achievements bar.

SOLVED

ACC Expression Help - String after character

Avatar

Level 2

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!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

Use these built-in functions:

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

Thanks,

-Jon

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi,

Use these built-in functions:

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

Thanks,

-Jon

Avatar

Level 1

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

Avatar

Level 2

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