How do I pull a string given varying input values

Hi,

I have a column with data somewhat similar to the values below. I would like to pull the 10 character values (i.e. PGHK000580, MVHK001582, PGTW000427, PFHK001535, ZOHK001596 etc.) within each row and append it as a new column.

Would appreciate any help I can get from the community. Thanks in advance!

CP~PGHK000580_OB~2_ST~12345
CP~MVHK001582_OB~2_ST~1234567890
CP~PFHK001535_OB~2_ST~567890
CP~PGTW000427_OB~2_ST~3
CP~ZOHK001596__OB~2_ST~3
PGHK000580 TEXT 1234567890
MVHK001582 TEXT 3 4 5
PFHK001535 TEXT 5 6 7
PGTW000427 TEXT1234567890
ZOHK001596 TEXT
OB~2_ST~3_CP~PGHK000580_CY~1234567890
OB~2_ST~3_CP~MVHK001582_CY~4
OB~2_ST~3_CP~PFHK001535_CY~4
OB~2_ST~3_CP~PGTW000427_CY~4
CP~ZOHK001596__OB~2

Hi @sljw you might try the Regex Split node for this.

Configure a pattern like this:
afbeelding
This will result in three additional columns and in the second is the text you’re looking for.

6 Likes

Thanks @JanDuo ! It works perfectly!

2 Likes

Hi there,

if you remove parentheses around .* you’ll get only one column with value you are looking for :wink:

Br,
Ivan

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