40fingers / Mass-Manipulate

The DNNCMS module allows you to Manipulate Page, Modules, Users etc. in bulk
MIT License
4 stars 3 forks source link

DB Replace Issue with Quotes #35

Closed Timo-Breumelhof closed 3 years ago

Timo-Breumelhof commented 3 years ago

When replacing text like this:

Test text with "quotes"

Something goes wrong if you use a " in your regex.

OC example data:

{
  "Title": "My title",
  "Text": "<h2>HTML Title</h2>\n\n<p>&lt;h2&gt;HTML endoded Title&lt;/h2&gt;</p>\n\n<p>This is a test with &quot;Quoted Text&quot; to ee if we can use it to replace.</p>\n\n<p>&nbsp;</p>\n",
  "_id": "60f04998c937df03e8b41e15"
}

Search test: "Text": "(.*?)" Replace text:

"Texts":
[
      {
        "Title": "",
        "Text": "$1"
      }
]

Result:

image

You can see that the matching stops at the (in the database) HTML encoded Quote, which is not correct.