-
Notifications
You must be signed in to change notification settings - Fork 854
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 URLs are not found #365
Comments
same problem for me |
We can replicate the issue also - any url containing a '/' or '' is no longer found in version 4 |
UPDATE: The web version seems to have some problems with the '/' delimiters it prepends/appends to the regex, I actually modified those to '#' in the srdb code. I have found a temporary solution, maybe even permanent for me, which is using regex, as regex search-replace doesn't seem to be affected by the problem. I will give you the example I used, in case someone has a similar requirement: Search: Replace: This will replace:
respectively with:
Which makes WordPress sites imported locally work flawlessly no matter how many plugins there are. 🙂 |
@GigiSan solution works great! The tricky part is to pass regex that complex from bash script level. I've wrote a simple function which is responsible for running search-and-replace from command line First argument is old url we want to replace, second the new one and third the protocol (http or https) we want to start using. run_replace() {
existing_domain="$1"
new_domain="${2}"
new_protocol="${3}"
srdb_root_path='/usr/local/lib/search-and-replace'
if echo $PHP_VERSION | grep -q '5.6' || echo $PHP_VERSION | grep -q '7.1'; then
srdb_path="${srdb_root_path}/3.1"
else
srdb_path="${srdb_root_path}/4.1"
fi
# regex from: https://github.com/interconnectit/Search-Replace-DB/issues/365
php "${srdb_path}/srdb.cli.php" \
--host $MYSQL_HOSTNAME \
--user $MYSQL_USERNAME \
--pass $MYSQL_PASS \
--port $MYSQL_PORT \
--name $MYSQL_DATABASE \
--search "#$(echo '(http(s)?)((\\:\\/\\/)|(\\:\\\\\\/\\\\\\/)|((\\:|\\%3A)\\%2F\\%2F))('"$(echo $existing_domain | sed 's|\.|\\\\\.|g')"')')#" \
--replace $(echo $new_protocol'$3'$new_domain) \
--debug --verbose --regex
}
|
Hello everyone,
Since v4 it looks like escaped URLs are not found properly.
Consider a row with this value:
{"action":"console","days":90,"prev":{"country":"all","profile":"https:\/\/testdomain.com\/"}}
If I just search for
testdomain.com
and replace it withanotherdomain.com
, this row gets found correctly.But if I have to replace the full URL because, for example, I have to change protocol and turn
https:\/\/testdomain.com
intohttp:\/\/anotherdomain.com
, the search string is not found in this case.Some more deatils on the matter:
If you need any further info please let me know.
Meanwhile, thanks in advance for your time and have a nice day!
Regards,
-Gigi
The text was updated successfully, but these errors were encountered: