Q:

oracle regular expression to extract decimal numbers from string

I am trying to extract decimal numbers from a random string. How to do this using regex_replace function? Optionally i want to retain negative sign for negative integers.
example: 
input: 
'text abc023.46'
 '-123.12abc'

output: 
023.46
-123.12

A:

Use REGEXP_SUBSTR:
SELECT REGEXP_SUBSTR(col, '-?\d+(\.\d+)?')
FROM yourTable;

This pattern also makes the decimal component optional.

