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

Jon
  • 766
  • 1
  • 9
  • 27
  • Is the percentage always before the date? Is the date fixed length (eg. 01-NOV-2021 as opposed to 1-NOV-2021)? – Shadow Jul 11 '17 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. – cwallenpoole Jul 11 '17 at 20:34

0 Answers0