REGEX Help

Hi,
I am trying to split out 7 digits and 2 letters from a line of text but I am unsuccessful. I am using the row splitter node.

My RegEx:
\d{7}[A-Z][A-Z]

Sample Data:
1234567AA
this.is.sampletext.1234567AA.text
Another.2.sample.1234567AA.text

Can someone please help

Thank you

Hi @UnknownValue ,

I think you are using the wrong node but from your description I am not 100% sure what you need.

If you want to split the text into multiple columns - then this node might be the one you are looking for

If you want to only keep your regex match as a new column then the string replacer node might be what you are looking for

3 Likes

I tried the node but it still does not work, I think the issue is with regex itself…

Hi @UnknownValue,

Could you give an example what your desired output for the following texts would look like?

1234567AA
this.is.sampletext.1234567AA.text
Another.2.sample.1234567AA.text

If you want it to turn into:
1234567AA
1234567AA
1234567AA

then try the string replacer node mentioned in my first post with
Regex: .{0,}(\d{7}[A-Z]{2}).{0,}
Replace by: $1

Or easier and better for testing -use the palladian regex node:

Here you can just use your existing regex

6 Likes

This worked perfectly, and I will look into Regex extractor too! Thank you!

3 Likes

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