Jump to content

Find/Replace Text in Posts - SQL?


Matt Johnson
 Share

Recommended Posts

Hello,

Is there a easy way to find and replace text from posts? For example, I am wanting to change all instances of one URL (http://xxxxxx.com/xxxxx) to (http://yyyyy.com/xxxxx) I am thinking an SQL command, but I tried this SELECT REPLACE ('http://xxxxxx.com/','http://xxxxxx.com/','http://yyyyy.com/') and it ran but didn't update anything.

Edited by Matt Johnson
Link to comment
Share on other sites

Should be something like this ..

UPDATE table

SET column = REPLACE( column, 'xxxxx.com', 'yyyyy.com')

WHERE column like '%xxxxx.com%';

​Would this replace the actual text in the posts? That is what I am trying to change. The board migrated over to the new URL fine and I updated the global file. No issues there. I am trying to change any text/links that people posted referencing the old domain. In theory, the 301 redirect should cover it, but I'd like to clean it up if possible.

Edited by Matt Johnson
Link to comment
Share on other sites

​Would this replace the actual text in the posts? That is what I am trying to change. The board migrated over to the new URL fine and I updated the global file. No issues there. I am trying to change any text/links that people posted referencing the old domain. In theory, the 301 redirect should cover it, but I'd like to clean it up if possible.

​Yes. You will have to find the right table and column but it will replace anything that matches that string value.

Link to comment
Share on other sites

​Would this replace the actual text in the posts? That is what I am trying to change. The board migrated over to the new URL fine and I updated the global file. No issues there. I am trying to change any text/links that people posted referencing the old domain. In theory, the 301 redirect should cover it, but I'd like to clean it up if possible.

​Yes. You will have to find the right table and column but it will replace anything that matches that string value.

Yes. Same what he said .. If you not feel so familiar with MySQL, please make a test database first with a simple table where you can test this replacement function first, and check the result ..

 

.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...