Search
Other DB Replacer questions
Forum

Regex Search broke Database

Elisa Foltyn's Avatar Elisa Foltyn
Hi Peter, I used this Regex to search for links in the fulltext column and the search took very long so I closed the window and the database was broken afterwards. My client restored the database and then I searched again, it took again very long, the site was not reachable during this, but then I kept waiting and the site came back and luckily the database was not broken again. Not sure if you have any idea why this could have break the db and how to prevent it in future?
<a\s+[^>]*href="([^"]*)".*?>.*?\exampletext\b.*?</a>
and
<a[^>]*>((?:[^<]*(?:<(?!\/a)[^>]*>)*[^<]*)*example(?:[^<]*(?:<(?!\/a)[^>]*>)*[^<]*)*)<\/a>
thank you !
Peter van Westen's Avatar Peter van Westen ADMIN
Pretty complex Regular Expressions, that will indeed take a lot of memory for Mysql.
Try to not use .*? as much as possible.

So for instance, instead of doing:
href="([^"]*)".*?>
Do:
href="([^"]*)"[^>]*>

Also, probably best to do these in small chunks. So with like 50 or 100 results at a time.

What exactly are you trying to search and replace? Maybe there is a better/lighter way to do it by - for instance - doing a number of simpler replacements.
Please post a rating at the Joomla! Extensions Directory
Elisa Foltyn's Avatar Elisa Foltyn
A lot of articles, were moved into another category and menu item, so I have tons of 404. I thought of fixing them by the anchor text, but the anchor might be in another tags and the link sometimes have different attributes.

Now I broke the site again. Is there a way to reanimate the MySQL?
Peter van Westen's Avatar Peter van Westen ADMIN
I assume you backed up the db before doing the replacements...
I am not sure why your database would break. I guess your database hangs for some reason and if the process gets cut off, the db gets corrupted.

Maybe best to do an export of your db and do the replacements via your text editor instead.
Please post a rating at the Joomla! Extensions Directory
Elisa Foltyn's Avatar Elisa Foltyn
OK thank you! I wanted to login by User dbxxxx_27 already has more than 'max_user_connections' active connections, I hope the connection will be terminated somehow automatically, so I can look into the db
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription