Regex for data transformation

I am having trouble specifying regular expression for text transformation. I need to find all values that start with any letter (for that matter I also need to find values that start with either B or O). Whatever regex expressions that online regex tool suggest keep failing in Knime.

Please help: which node and what expression would work here?

Hi @IrynaK,

Since you are posting this in the Text Processing section, I assume you use the Text Processing extension and want to filter a document with a RegEx? If so, did you take a look at the RegEx Filter node?

Cheers,
Simon

you could convert the string to a document and use RegEx Filter like @SimonS suggested. In your case a Rule engine might also work but using Documents gives you access to more functions.

The comparison between the documents is maybe not the most elegant way. Someone with more experience in Text processing might suggest another approach.

And I always found the site https://regex101.com quite useful to test regular expressions. Sometimes you would have to also test a few strange cases that might appear.

image

kn_example_regex_letter_bo.knwf (32.2 KB)

2 Likes

can you please provide an example case of what exactly you want to do?

1 Like

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