MYSQL REPLACE string content with field value
String literals must be enclosed by quotes '.

Quote symbols within a literal must be quoted by slash as \'.

SELECT REPLACE(html_input,'!value',field_value) 
FROM table
/* WHERE html_input = '&lt;input type=\'text\' value=\'!value\'&gt;'
     AND field_value = 'test';
*/