I have table with field called description which contains text like following
|Description |
|----------------------------------
since this question is still in top google results, maybe the answer might help someone:
a quick function that replaces the content between two characters. It should work with words as well, but I haven't test it with words. For deleting in the following string: "this is a [demo]"
the string between [ and ] do:
select deletestr("this is a [demo]" ,'[',']');
and the function:
CREATE DEFINER=`replace_with_your_db`@`%`
FUNCTION `deletestr` (`inputstr` TEXT CHARSET utf8, `fromstr` VARCHAR(10) CHARSET utf8, `tostr` VARCHAR(10) CHARSET utf8) RETURNS text CHARSET utf8
NO SQL
RETURN
replace(inputstr,substr(inputstr, locate(fromstr,inputstr),locate(tostr,inputstr)-locate(fromstr,inputstr)+length(tostr)),'')