0

I'm trying to replace all instances of   with a simple space EXCEPT if it's surrounded by DIV tags. I've tried tinkering with the NOT REGEXP and NOT RLIKE within the replace query, like this:

UPDATE table SET column = replace(column,NOT REGEXP '>&#160;<',' ');

But it gives a syntax error. Anyone have any suggestions?

0

2 Answers 2

1

How about three separate updates...

  1. UPDATE table SET column = replace(column, '>&#160;<', '%%LOL$$');
  2. UPDATE table SET column = replace(column, '&#160;', ' ');
  3. UPDATE table SET column = replace(column, '%%LOL$$', '>&#160;<');
Sign up to request clarification or add additional context in comments.

Comments

0

Something like this should work:

UPDATE table SET column = REPLACE(column, '&#160;', ' ') WHERE column NOT LIKE '%div>&#160;</%'

1 Comment

I tried this and it said over 8K rows affected, and when I went in and looked at one of them it all looked the same as before. eek lol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.