I'm trying to extract the following
Source | Result |
RIS T/F FROM 4295620000 | 4295620000 |
RES TF FROM 8233040415-PC | 8233040415-PC |
228880217-01 residual t/f | 228880217-01 |
4214690617 REFUND RESIDUAL MOV | 4214690617 |
Resid Trf- 16-013554 | 16-013554 |
4273700000-ST.Thomas GGG | 4273700000 |
4273700000-PC-ST.Thomas GGG | 4273700000-PC |
Solved! Go to Solution.
Hi @SYang1
Why doesn't "4273700000-ST.Thomas GGG " result on 4273700000-ST?
Could you give more details about the logic?
Cheers,
This also works
REGEX_Replace([Source], ".*?(\d+)(-(?:\d+|PC))?.*", "$1$2")
Cheers,
This thread has gotten very very stale. Looks like I came up with nearly up the same @JeffF:
(?<REF>\d+(?:\-PC|\-\d+)?)
As a way to parse out what I am calling "REF". Other than that, @JeffS and I have close to the same answer. I am allowing for an OR with the pipe (" | ") under the guise that you would not have -##s AND -PC in your desired outcome. If you want to be able to have both, his allows that and mine is a bit stricter. Without a full set of data to look for other situations.
Advantage of mine would be a slight increase in speed if the data was big enough for that to make a difference.
Maybe someone could put this discussion to bed by marking a solution?!?
Cheers!