1

Is there a simple way to do the following in mysql:

"Value ( some stuff here) " --> "Value"

Something similar to REPLACE("(*)","")? How would I go about doing this and stripping the remaining whitespace?

2 Answers 2

0

In mysql you cannot replace items of rows with regexp help. So you have to select all values "Value ( some stuff here) " from a defined column. Process them on a client-side with python facilities. After that you need update all rows in a mysql database.

Or you can read this answers How to do a regular expression replace in MySQL?

0

Try:

"/s*/(.*/)/s*"

This will match leading whitespace, the text in parenthesis and trailing whitespace.

Look at UDFs(user defined functions). You'll want something like oracle's REGEXP_REPLACE

2
  • 1
    MySQL don't supports regexp
    – edem
    Commented Dec 30, 2012 at 21:43
  • 2
    Sorry, I wrote it about find & replace function in mysql
    – edem
    Commented Dec 30, 2012 at 21:54

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.