I want to be able to remove characters from a string only up to the first numeric value. If there are any after the numeric I want to keep them.
e.g. 'AB1234' should become '1234', 'AB1234C' should become '1234C'.
There also could be spaces and other types of characters at the start. I have tried this:
select
regexp_replace('ABC1234', '[^[:digit:]]'),
regexp_replace('AB 1234', '[^[:digit:]]'),
regexp_replace('AB 01234', '[^[:digit:]]'),
regexp_replace('AB1234C', '[^[:digit:]]'),
regexp_replace('^1234', '[^[:digit:]]'),
regexp_replace('*#1234Z', '[^[:digit:]]')
FROM DUAL
For all except 'AB 01234' it returns '1234' so it only keeps the numeric. For 'AB 01234' it correctly returns '01234'
The ones incorrect are those with a character after the numeric e.g. 'AB1234C'.
I know I am missing something here, can anyone please help with this?
Thanks