How can I use this string replace in MySQL

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

Solutions

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 ', ''), '.', '');
Tags: Mysql / Wordpress / Replace

Similar questions

Replace a string in MySQL in a specific field depending on the value of another field
How can I find and replace in MySQL depending on the values of another field? For example, I want to replace all of the "0" values in the column "post_parent" with "126810"...but only if those entries also have a value of "topic" in the "post_type" field. I thought it would be something like this but it doesn't seem to work, syntax issues and all: ...
Replace part of string in mysql table column
I have a wordpress installation and I've broken the mysql database. For posts the urls are listed as '.../wordpress//...' instead of '.../wordpress/...' How in SQL can I go through every row in the table and (perhaps use a regular expression) to replace every instance of 'ss//' with 'ss/'?
Find and replace a string in MySQL Table
I wish to update tables in a WordPress database, and I am confident with what I wish to achieve, and it won't do any damage, I am struggling to achieve what I want. in the post_content field there is: Now I wish to replace the img class with I know how to update the table - but I can't figue out how to match what I wish to update. I would like to a...
SQL Query for Search & Replace(Need to update) the whole database if matched the string in phpMyAdmin/MySQL - wordpress site
Currently i have the links look like as http://example.com, http://example.com/images, http://example.com/posts/..., http://example.com/links/... about 3000+ matched on the database need to be updated with "https" like as https://example.com, https://example.com/images, https://example.com/posts/..., https://example.com/links/... Where i have alrea...
Replace complicated string in MySQL
Some script kiddie hacked my wordpress website and inserted this code into every post_content in wp_posts: I want to remove it by SQL query (UPDATE xxx SET replace(...)) in phpmyadmin, but I have no luck with escaping the string. is there any way/tool to correctly escape this code and remove it from the table? thx
Replacing String with Apostrophe in MySQL When running a find and replace query
I have a table called my_table with 2 fields ID and dbtext. The fields in the database are: ID: 1 dbtext: Hi this is Bobby's Stuff I am trying to find and replace text within the dbtext field. Here is my code: Unfortunately when I strip the slashes, the query won't run due to the single quotes breaking the query. However, if I don't strip the slash...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.