string manip node help

Hello everyone,
I’m needing some assistance on some regex for the string manipulation node. Can anyone edit this regex
to work in the node. I’am wanting to extract social sec numbers from a pdf file. I tried to make it work using regex(replace but I can’t seem to get the correct syntax to work. Any help needed would be appreciated.(note: yes i know this regex expression is specific and wont extract socials starting with 000,666 or 9)

Hi @NabilEnn

The KNIME compatible version is:

Note that in KNIME you always have to escape special chars so \ becomes \\

1 Like

thank you for the reply, so if my column name was content
i would enter the regex like this into the string manip node

replace(regexReplace($Content$,^(?!(000|666|9))\d{3}-(?!00)\d{2}-(?!0000)\d{4}$, $Content$, “”)

please help me adjust if i have made any mistakes, thanks again!

No, you used the original regex, need to use quotes and you also don’t need an additional replace.

regexReplace($Content$, "^(?!(000|666|9))\\d{3}-(?!00)\\d{2}-(?!0000)\\d{4}$", "")

I will try it, thank you!