sql – REGEXP_REPLACE in post_contet

Question

So, basically, I want to remove trailing slashes from specific domain urls. For example: https://www.something.com/here/postname/
into https://www.something.com/here/postname

I have 10.4.21-MariaDB which should support REGEXP_REPLACE function.

This is my query:

UPDATE wp_posts SET post_content = REGEXP_REPLACE(post_content, '(http\S+)\/(\s|$)', '$1');

or this one more specifically:

UPDATE wp_posts SET post_content = REGEXP_REPLACE(post_content, '(https:\/\/www\.something\.com\/here\/\S+)\/(\s|$)', '$1');

which according to regular expressions should work:
https://regex101.com/r/slLbgg/1

What am I doing wrong?

Any kind of help is appreciated! 🙂

0
Ivana Kruljac Beni 4 months 2022-04-22T09:22:50-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse