0

I have a table in MySQL, and I need to extract some data from a column using a regular expression.

The column (varchar, utf8_unicode_ci) has entries like this:

Some Text with spaces 6.112% 10-NOV-2021

I would like to extract the percentage number.

6.112%

And / or FROM the percentage number

6.112% 10-NOV-2021

Not all numbers have the same number of digits.

Any ideas?

Thanks

2
  • Is the percentage always before the date? Is the date fixed length (eg. 01-NOV-2021 as opposed to 1-NOV-2021)?
    – Shadow
    Commented Jul 11, 2017 at 15:52
  • Bill's right, there is no way to accomplish this in MySQL (though there is in MariaDB). You'll need to look for the last space before the % and use substr. Commented Jul 11, 2017 at 20:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.