Use of REGEX splitter

Hello community,
I am struggling with the REGEX splitter. I have a string and I want to split this into one new column.
Here is an example string:
“Real specification is created as per the BBE request.
NPDI#100000000000000460142023;Text added by,20231124,09:20:25”

I need to split off the number “100000000000000460142023” only. The number is always at least 20 digits. So this should be in a new column independent were the number is in the string.
I tried already ^[^0-9]+(\d{20,})(.*) but this is not splitting correctly in all case.

Can someone help a regex noob :slight_smile:

Hi,
If you only want to extract this one number, you can also use the String Manipulation node with this expression:

regexReplace($column$, ".*[^0-9]([0-9]{20,}).*", "$1")

I think the problem with your regex is that it does not allow any number until your target number appears. In my regex, I say you can have anything, then not a number, then your target number, then anything again.
Hope this helps!
Alexander

Thanks that works for entries that have the number. But I have also rows where the number is not in the string. In this case the output should be empty. I could solve this with a rule engin afterwords but would be great to have this in one step.

Hi,
In that case you can use the Regex Split with exactly the same regex. It will return a missing value if the number is not present.
Kind regards,
Alexander

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.