1

I'm using Wordpress and have a load of custom fields where I need to do a string replace on. Basically I have a price field which is in the example format: from 113.800

I need to remove the word 'from', the space after it and the dot between the number. All the fields are in this format, how can I use a MySQL replace function to do this?

Thanks

1 Answer 1

1

REPLACE() doesn't support regular expression matching, so you'll have to do it in a more clumsy way:

UPDATE wp_sometable
SET price_field = REPLACE(REPLACE(price_field, 'from ', ''), '.', '');
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.