Suppose I have a field:
product_strength
10MG/ML
0.25MG
25MG
0.125MG
How do I extract just the "numeric" part and then cast to numeric? I can get this far: regexp_replace(product_strength, '(\D|!\.)','','g')::numeric AS result_numeric
But the problem with this is that it doesn't actually account for the decimal. In other words, this returns
product_strength result_numeric
10MG/ML 10
0.25MG 25
25MG 25
0.125MG 125
But I would want to return
product_strength result_numeric
10MG/ML 10
0.25MG 0.25
25MG 25
0.125MG 0.125