da manuale mysql:
....
REPLACE(str,from_str,to_str)
Returns the string str with all occurrences of the string from_str replaced by
the string to_str:
mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww');
-> 'WwWwWw.mysql.com'
This function is multi-byte safe.
.....
per cui si puoi solo con sql.
inoltre ti può essere di aiuto ...
INSTR(str,substr)
Returns the position of the first occurrence of substring substr in string str.
This is the same as the two-argument form of LOCATE(), except that the arguments
are swapped:
mysql> SELECT INSTR('foobarbar', 'bar');
-> 4
mysql> SELECT INSTR('xbar', 'foobar');
-> 0
This function is multi-byte safe. In MySQL 3.23 this function is case sensitive,
while in 4.0 it’s only case sensitive if either argument is a binary string.