Escaped URL seems to be ignored with Regex
anasmoiz opened this issue · comments
Hi,
There seems to be an issue when the script is used with regex and escaped URL together which results in incorrect S&R being applied across the database
To replicate the issue create a post in WordPress with the following text.
http://domain.com
https://domain.com
//domain.com
domain.com
test@domain.com
test.domain.com
domain-com
domain(com
domain)com
domain_com
domain$com
domain@com
Now execute Search and Replace via CLI or UI, it doesn't matter.. the results are same but here is the CLI command.
php srdb.cli.php -h localhost -u 'mysql_user' -p '$mysql_password' -n '$db_name' -g -s '/(?<!@)domain\.com/' -r 'newdomain.com'
After running the above command the incorrect text results I got is shared below:
http://newdomain.com
https://newdomain.com
//newdomain.com
newdomain.com
test@domain.com
test.newdomain.com
newdomain.com
newdomain.com
newdomain.com
newdomain.com
newdomain.com
newdomain.com
However, my expected result was:
http://newdomain.com
https://newdomain.com
//newdomain.com
newdomain.com
test@domain.com
test.newdomain.com
domain-com
domain(com
domain)com
domain_com
domain$com
domain@com
The script should S&R according to this pattern, but instead, it seems to be following this one it's like the escaped URL was ignored
@gianluigi-icit I would appreciate it if you can take a look at this.