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?

David542
  • 104,438
  • 178
  • 489
  • 842

2 Answers2

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

Kyle
  • 1,019
  • 1
  • 10
  • 19
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?

Community
  • 1
  • 1
edem
  • 3,222
  • 3
  • 19
  • 45