I have the this string: 'STRING_EXA2MP_3LE'. I want to obtain all the characters until there is an underscore followed by a digit, which in this case would output 'STRING_EXA2MP'. How could I obtain this?
This is what I have tried so far.
SELECT
regexp_substr('STRING_EXA2MP_3LE', '[^(_0-9] ', 1, 1)
FROM
dual
CodePudding user response:
Try this:
SELECT regexp_substr('STRING_EXA2MP_3LE', '(. _?)_[0-9]?', 1, 1,'i',1)
FROM dual;
CodePudding user response:
Select regexp_replace('STRING_EXA2MP_3LE', '_[0-9].*') from dual