0

I wanna delete CDATA from my filter tag in many .xml files via Intellij Replacement Tool with the following regex.

Search: <filter>(?:\s)*<!\[CDATA\[((?:\s|\S)*?)]]>(?:\s)*<\/filter>

Replace: <filter>$1<\/filter>

<filter><![CDATA[CONTENTX]]></filter> // from
<filter>CONTENTX</filter>             // to

If I open the tool with ctrl + shift + f and enter the regex a stack overflow error occurs.

Regular expression failed to match
(?:\s)*(?:\s)*\/filter> produced stack overflow when matching content of the file C:/Users/...
laprof
  • 1,246
  • 3
  • 14
  • 27
  • 1
    Never use `(\s|\S)*` when all you mean is `(?s).*`. Also, `(?:\s)*` = `\s*`. – Wiktor Stribiżew Jun 11 '19 at 08:21
  • Thanks @WiktorStribiżew for your explanation and how to do it better, but I cannot change the expression for business reasons. I increased the jvm stack with the following command `-Xss40m`. – laprof Jun 11 '19 at 08:58

0 Answers0