I'm trying to replace this part in the line

update pages set text_ro = replace(text_ro, '<p> &nbsp;</p>','') 

In the database, it is also entered with spaces, but in the end returns an empty query, how to be?

 <p> &nbsp;</p> - вот так в бд хранится 
  • (1) "... but ultimately returns an empty query" UPDATE is not a SELECT for you, it should not return records. - artoodetoo
  • (2) it looks like your data is not just with a space, but with line breaks and, possibly, with tabs. I advise you to do work in php or another scripting language, through regular expressions or the XML parsing library. mysql does not have adequate tools for complex text processing. - artoodetoo

1 answer 1

You will have to exactly repeat the structure of your whitespace characters (line feed and 7 spaces) for the UPDATE perform the replacement. Or so

 UPDATE pages SET text_ro = REPLACE(text_ro, '<p> &nbsp;</p>', '') 

Or by writing a newline explicitly

 UPDATE pages SET text_ro = REPLACE(text_ro, '<p>\r\n &nbsp;</p>', '') 

Unfortunately, MySQL does not support replacement with regular expressions at the REPLACE() level, so it is rather difficult to build a more or less universal solution using MySQL alone.