Page 1 of 1

Possible to run a regex from within a sql query?

Posted: Wed Feb 16, 2005 3:02 pm
by Burrito
I have some content from an LMS here that has our old domain in it that I need to just replace with our new domain (for img references and hrefs).

is it possible to do a "search" on the table field for the old domain and replace it with the new domain?

my alternative is to export the data, open a text editor and do a find and replace there, then re-import the data.

I'd like to avoid that if possible.

Burr

Posted: Wed Feb 16, 2005 3:08 pm
by feyd
what's wrong with writing a bit of a script to search the table, then update each record found updating the table as it goes?

Posted: Wed Feb 16, 2005 3:10 pm
by Burrito
yes thought about that after I posted.

gonna give that a go...

thx,

Burr

Posted: Wed Feb 16, 2005 3:31 pm
by jonemo
you can use REGEXP() in where statements. however you cannot use something like [p/e]reg_replace on the database.