Woundorf / foxreplace

Replace text in webpages
https://addons.mozilla.org/firefox/addon/foxreplace/
GNU General Public License v3.0
90 stars 22 forks source link

When using the function replace option, the p1, p2, …, pN and group parameters don't work #362

Closed dcunhas closed 10 months ago

dcunhas commented 10 months ago

When using the function replace option, the p1, p2, …, pN and group parameters don't work. I haven't tested all others, but I am able to use match.

A trivial example: Replace: (the) (word) With: p1 + 'test' + p2 fails to work and instead also prevents all subsequent replacements from working (presumably due to the script erroring).

However, Replace: (the) (word) With: match.replace(/(the) (sign)/gi, '$1 test $2') works as expected, resulting in the test word.

If it's relevant, I'm on Firefox 121.0.

In addition to fixing this, I'd recommend adding a try-catch group around executing a replacement function so that if it errors for whatever reason it doesn't affect subsequent replacements.

Woundorf commented 10 months ago

Apparently, p1 works but p2 fails. I will look into it when I can.