0

There's a column in my database which has got this kind of value:

id|       body
-----------------------------------
1 | ... <img src=test.jpg> ... 
2 | ... <img src=test2.jpg> ... 
3 |... <img src=tests3.jpg> ....

Basically, after the = sign I can have anything. And I would like to change it for nothing.

I know if it was a static value I could use:

SELECT REPLACE(column, $$<img src=tests3.jpg>$$, ' ') FROM table

But I couldn't do it dynamically.

1 Answer 1

0

regexp_replace() seems ideally suited

SELECT REXEXP_REPLACE(column, $$<img src=[^>]*>$$, ' ','g') FROM table

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.