Jan 08, 2023 02:11 PM
If I have these values in a formula field,
0_99_123_456_abc_wantedtext1
_ppp_876_333_wantedtext2
hhh_kol_ggb_hhh_sss_wantedtext3
can someone please tell me how to extract the following text into a new field please?
wantedtext1
wantedtext2
wantedtext3
Thanks in advance.
Solved! Go to Solution.
Jan 08, 2023 09:25 PM
Thanks for the reply. Right$ wont work as variable length, but what will stay the same is that it will be the string after the last underscored every time.
Jan 08, 2023 09:38 PM
Hi Jon, try out: `REGEX_EXTRACT(Name, "[^_]*$")`
Jan 08, 2023 09:15 PM
There are a couple of approaches to this, but if the "wantedtext" bits are all the same number of characters you can use the RIGHT() function, which extracts text starting from the end of the string up to the number of characters you specify.
Otherwise, it's a matter of figuring out if there are other consistent patterns in your naming convention we could consistently match. For instance, since we know the underscore always precedes the "wantedtext", we could right a match rule for that. It all depends on how uniform your conventions are and how they are generated.
Jan 08, 2023 09:25 PM
Thanks for the reply. Right$ wont work as variable length, but what will stay the same is that it will be the string after the last underscored every time.
Jan 08, 2023 09:38 PM
Jan 08, 2023 09:41 PM
That's brilliant @TheTimeSavingCo ! I was just about to post my regex expression too, which technically worked but wasn't as efficient as yours.
Jan 08, 2023 10:04 PM
Thank you so much!