I have a column of V_strings called Code. The values all start with zeros. I need to remove the leading zeros then put them back later on. If I use TrimLeft([Code],"0") it does trim the zeros but I loose count of how many zeros I had. My plan is to put the zeros in another column to concatenate them back later. For example:
000123F-001 -------> 000 + 123F-001 ---------> 000123F-001
I'm pretty sure I have to use a RegEx to do this but after playing with various regular expressions it seems I can't find which one works. My guess to extract the leading zeros is something like this:
REGEX_Replace([Code],"(^0+)[!0]\w+","$1")
But it does not work.
Any help is appreciated.
Solved! Go to Solution.
What about using the following expression in your Regex?
This is what I've got as a result:
Cheers,
Seinchyi
Hi @NAC, @seinchyiwoo has already provided a solution but wanted to propose a non-regex approach if you were curious.
You could add back the leading 0's with padleft ([NEW_FIELD], [COUNT_ZERO],'0')