I am looking to use a regular expression to capture the last value in a string. I have copied an example of the data I am looking to parse. I am using oracle syntax.
Example Data:
||CULTURE|D0799|D0799HTT|
||CULTURE|D0799|D0799HTT||
I am looking to strip out the last value before the last set of pipes:
D0799HQTT
D0799HQTT
I am able to create a regexp_substr that returns the CULTURE:
REGEXP_SUBSTR(c.field_name, '|[^|]+|')
but I have not been able to figure out how to start at the end look for either one or two pipes, and return the values I'm looking for. Let me know if you need more information.
array = str.split('|'); int i = array.length; while(array[i].isEmpty()){ i--; } array[i] = yourLastValue;Hope its clear what I wrote. ;)