Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escaped URL seems to be ignored with Regex #370

Open
anasmoiz opened this issue Oct 27, 2021 · 0 comments
Open

Escaped URL seems to be ignored with Regex #370

anasmoiz opened this issue Oct 27, 2021 · 0 comments

Comments

@anasmoiz
Copy link

anasmoiz commented Oct 27, 2021

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
[email protected]
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
[email protected]
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
[email protected]
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant