Regex if-else expression
- by craig
I'm trying to extract the # of minutes from a text field using Oracle's REGEXP_SUBSTR() function.
Data:
Treatment of PC7, PT1 on left. 15 min.
15 minutes.
15 minutes
15 mins.
15 mins
15 min.
15 min
15min
15
In each case, I'm hoping to extract the '15' part of the string.
Attempts:
\d+ gets all of the numeric values, including the '7' and '1', which is undesirable.
(\d)+(?=\ ?min) get the '15' from all rows except the last.
(?((\d)+(?=\ ?min))((\d)+(?=\ ?min))|\d+), an if-else statement, doesnt' match anything.
What is wrong with my if-else statement?