2

I would like to replace "|" with "_" in mysql if meets the following query

SELECT COUNT(*) FROM wp_posts WHERE post_content REGEXP 'text\\(584\\|([a-zA-Z0-9_]+)\\|([a-zA-Z0-9_])'

so if finds for example text(584|g345|2344 should look at the end text(584_g345_2344

Is it possible if I use REGEXP to find matches?

1 Answer 1

3

You can use:

REPLACE(text_string, from_string, to_string)

More info can be found in here.

EDIT:
However, you cannot mix REGEX and REPLACE.
You'll need to have it done with several queries, have you seen this?

Sign up to request clarification or add additional context in comments.

Comments

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.