I want to extract some strings from the VAL column, according the regex furhter below in bold. This is an example of the data I have in source :
Table1
-----------------
ID VAL
-----------------
1 GR-RDE
2 GR-RZA-RDE
3 GR-RZA-RDE_RZA
4 GR-RGS
5 GR-RZA-OR-ORC
6 GR-RZA-RDE-OR-ORC_RZA
Desired result :
> Output
-----------------
ID RESULT
-----------------
1 RDE
2 RZA
2 RDE
3 RZA
3 RDE
4 RGS
5 RZA
5 OR
6 RZA
6 RDE
6 OR
To do that, I've done this regex : (?<=-)(RDE|RZA|RGS|OR)(?![A-Z])
- (?<=-) : checks that the character before is '-'
- (RDE|RZA|RGS|OR) : search for 'RDE', 'RZA', 'RGS', 'OR' strings
- (?![A-Z]) : ignore the string if it's followed by a letter
The regex works perfectly and it ignores all the unwhanted parts :

My problem is that I don't find the way to use this regex in a SQL statement (Oracle database). I've tried to perform a test with something like this, which returns Null :
select REGEXP_SUBSTR(VAL,'(?<=-)(RDE|RZA|RGS|OR)(?![A-Z])') from Table1;