How can I remove all occurrences of $ and , from a string using REGEXP_REPLACE in mysql-10.4.24-MariaDB?

Joined
Oct 24, 2013
Messages
47
Reaction score
0
I tried the following but it doesn't work.
REGEXP_REPLACE('$25,000.00','$|,',"")
REGEXP_REPLACE('$25,000.00','\$',"")
REGEXP_REPLACE('$25,000.00','[$,]',"")
 
Joined
Nov 23, 2023
Messages
59
Reaction score
3
I tried the following but it doesn't work.
REGEXP_REPLACE('$25,000.00','$|,',"")
REGEXP_REPLACE('$25,000.00','\$',"")
REGEXP_REPLACE('$25,000.00','[$,]',"")

To remove all occurrences of $ and , from a string using REGEXP_REPLACE in MySQL, you can use the following query:

sql
Copy code
SELECT REGEXP_REPLACE(your_column, '[$,]', '') AS modified_string FROM your_table;

Replace your_column with the name of the column containing your string, and your_table with the name of your table.

This query will remove all instances of $ and , from the specified column and return the modified string as modified_string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,794
Messages
2,569,641
Members
45,355
Latest member
SJLChristi

Latest Threads

Top