# RegexReplace in String Manipulation (Multicolumns)

**URL:** <https://forum.knime.com/t/regexreplace-in-string-manipulation-multicolumns/44876>\
**Category:** KNIME Extensions\
**Created:** [July 7, 2022, 11:25am UTC](https://forum.knime.com/t/regexreplace-in-string-manipulation-multicolumns/44876 "2022-07-07T11:25:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stanage](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@stanage](https://forum.knime.com/u/stanage)\
**Post date:** [July 7, 2022, 11:25am UTC](https://forum.knime.com/t/regexreplace-in-string-manipulation-multicolumns/44876/1 "2022-07-07T11:25:26Z")

</div>

Hi there,

I am using (or attempting to use) the String Manipulation (Multiple columns) to remove double quotes (’ " ‘) from a table. However, I can’t get the regex term right, and I also note the node throws an exception error when I try to do this, if it doesn’t find a quote. I am also using this node also to remove linefeed (’ \n ‘) and line break (’ \r ') from the table.

I did create a loop to do this, but it is slow, so string manipulation (multicolumn) is a lot faster.

The regex term used;  
Double Quote:  
regexreplace($$currentcolumn$$,“["”]“,”")

Linefeed:  
regexreplace($$currentcolumn$$,“[\n”]“,”")

Linebreak;  
regexreplace($$currentcolumn$$,“[\r”]“,”")

Any help would be appreciated.

Thanks,

Stanage

---

<div class="post-metadata">

**Author:** ![stanage](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@stanage](https://forum.knime.com/u/stanage)\
**Post date:** [July 7, 2022, 6:04pm UTC](https://forum.knime.com/t/regexreplace-in-string-manipulation-multicolumns/44876/2 "2022-07-07T18:04:30Z")

</div>

> [@stanage](#):
>
> Any help would be appreciated.

The double quote regex setting;

regexReplace($$CURRENTCOLUMN$$,“["”]“,”")

fails with the following error;  
RROR String Manipulation (Multi Column) 4:1051:0:1044 Execute failed: Execution stopped: Evaluation of expression failed for row “Row0”: java.lang.NullPointerException: Cannot invoke “java.lang.CharSequence.length()” because “this.text” is null

---

<div class="post-metadata">

**Author:** ![si\_daniel\_a](https://forum-cdn.knime.com/user_avatar/forum.knime.com/si_daniel_a/32/41923_2.png) [@si\_daniel\_a](https://forum.knime.com/u/si_daniel_a)\
**Post date:** [July 7, 2022, 6:05pm UTC](https://forum.knime.com/t/regexreplace-in-string-manipulation-multicolumns/44876/3 "2022-07-07T18:05:10Z")

</div>

Table Creator → Create a Column with the quotation mark → Connect to Table Row to Variable → Connect the Flow Variable to the String Manipulator → use formula: replace($your\_column$,$${Squotation\_mark\_flow\_variable}$$,“replacement\_char\_here”)

---

<div class="post-metadata">

**Author:** ![stanage](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@stanage](https://forum.knime.com/u/stanage)\
**Post date:** [July 7, 2022, 6:09pm UTC](https://forum.knime.com/t/regexreplace-in-string-manipulation-multicolumns/44876/4 "2022-07-07T18:09:00Z")

</div>

Solved the double quote by using the following in String Manpulation (column);

replace($$CURRENTCOLUMN$$,“"”,“” )

Will use the above suggestion to handle the linebreak and linefeed

---

<div class="post-metadata">

**Author:** ![stanage](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@stanage](https://forum.knime.com/u/stanage)\
**Post date:** [July 7, 2022, 6:34pm UTC](https://forum.knime.com/t/regexreplace-in-string-manipulation-multicolumns/44876/5 "2022-07-07T18:34:36Z")

</div>

Above replace string is missing escape character, need to but a back slash ’ \ ’ between first double quote and the second double quote in string “”"

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [July 14, 2022, 6:35pm UTC](https://forum.knime.com/t/regexreplace-in-string-manipulation-multicolumns/44876/6 "2022-07-14T18:35:09Z")

</div>

Closed on July 14, 2022, 6:35pm UTC

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