1

Is there anyway to update rows of one text column and remove extra spaces in between string,

The data is actually a JSON string, Following is the example string

{"ID"                                      :"95703",
 "LastName"         :"Trigger",
 "FirstName"                               :"Test", ... }

if you notice there are annoying white spaces between "ID" and its value :"95703",

is there anyway I can (in update query) update all rows and remove this white space (using regex)

the sample query I can run on this table is

UPDATE `user_log_data` SET data = {REGEX PART}

1 Answer 1

1
"[ ]+:

Try this.Replace by ":.See demo.

http://regex101.com/r/lZ5mN8/31

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

2 Comments

it will only search for the records right? can we remove those spaces in update query is the real question ?
@zzlalani you can use SUBSTR something like this to replace as well

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.