Attempting to change the “files” folder location in a Drupal site from /files to /sites/default/files.
In order to avoid changing anything else such as
http://www.google.com/profiles/
I’m trying to use a basic regular expression with a word boundary.
\bfiles/
A quick check in regexpal is working as expected, but when I enter the above in the phpMyAdmin search , checking the “as regular expression” checkbox, I don’t get the expected result.
Two questions:
-
How should I write my expression with a word boundary so that it works in phpMyAdmin?
-
I’m really a newbie at SQL statements! Would it be possible to write a SQL query that would simply look for every occurrence of “files/” & replace it with “sites/default/files/”?
According to the MySql docs, the regex flavour used is POSIX 1003.2. For this flavour of regex, word boundaries are as follows:
[[:<:]](beginning)[[:>:]](end)so your regex would be:
If you want to use sql to search and replace all instances of
[[:<:]]files/from a specific field in a table, you could use a UDF such as the one found hereAlso, you should be aware of the following while using regex with MySql: