By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
REGEXP_REPLACE(COL,'^(.*)_DIS.*$','\1') | REGEXP_REPLACE(COL,'^.*_DIS_([0-9]+)','\1') |
---|---|
a_b | 12 |
a | 13 |
c_d | 23 |
c | 22 |
REGEXP_REPLACE(COL,'^(.*)_DIS.*$','\1') | REGEXP_REPLACE(COL,'^.*_DIS_([0-9]+)','\1') |
---|---|
a_b | 12 |
a | 13 |
c_d | 23 |
c | 22 |