I have a big Wordpress site (>10,000 posts) and I would like to remove all outbound links + anchor texts from its posts.
I was able to code something that does the job through a regex search and replace on each post. But because I have so many posts, this script is virtually useless (problems of memory and time of execution on a shared server).
What's the best way to make a regex search and replace on the database while consuming the least amount of memory? Can I make a regex search and replace via mysql?
Can you also confirm that this is the regex that will match all links except those containing "mysite.com" (except internal links):
(<a.*>)(?!mysite\.com)(.*)(<\/a>)