Oracle SQL REGEXP 获取字符串中的最后一个数值

Oracle SQL REGEXP to fetch the last numeric value in a string

我在一列中有以下字符串值,我需要提取最后一个数值。我使用了 SUBSTR(ColumnA, -1, 1),但这只是提取最后一位数字。

ColumnA
12_23_AB245-F5
66_78_HJ378-G5567
55_16_GC761-B99898

下面是预期结果

ColumnA
5
5567
99898

此处使用 REGEXP_SUBSTR 模式 [0-9]+$:

SELECT ColumnA, REGEXP_SUBSTR(ColumnA, '[0-9]+$') AS last_digits
FROM yourTable;

Demo