MySQLdata extraction

Extract Price and Currency from MySQL Column with Regex

Use MySQL REGEXP_SUBSTR to extract price values with currency symbols from text columns. SQL regex examples for price extraction.

The Regex Pattern

Regex pattern

[$]?\d{1,10}(\.\d{2})?

Use this pattern with MySQL's REGEXP operator.

MySQL SQL Example

-- Extract price values like $19.99 from product description or notes column in MySQL using REGEXP_SUBSTR
SELECT *
FROM your_table
WHERE your_column REGEXP '[$]?\\d{1,10}(\\.\\d{2})?';

How This Works

Extract price values like $19.99 from product description or notes column in MySQL using REGEXP_SUBSTR. The regex pattern is used with MySQL's REGEXP operator to filter rows at the database level.

Using regex directly in SQL is efficient for use cases like data extraction โ€” it avoids loading data into application memory just to filter it with a regex.

Need a custom SQL + Regex query?

Describe your specific use case in plain English. RegSQL generates the exact MySQL query with the right regex pattern for your schema.

Related SQL Patterns