I'm new to use RegEx and I am trying to apply REGEXP_REPLACE with conditions if special character exists then apply regex else apply other regex for example
SELECT REGEXP_REPLACE ('PCB terminal block - FRONT 2,5-V/SA 5/10 BK - 1109601', '([^\-]+$)' , '') FROM dual;
output
PCB terminal block - FRONT 2,5-V/SA 5/10 BK -
above regex remove after last (-) and it's OK
but if my string does not contains (-) then this will return null as below
SELECT REGEXP_REPLACE ('PCB terminal block, nominal current: 4 A, rated voltage (III/2): 250 V, nominal cross section', '([^\-]+$)' , '') froM dual
output
null
i want to change this regex to return the string if it's not contains (-) is it possible?