Reputation: 1594
I have a multi-line field in this Fiddle of Oracle 11g table. Using SQL, how can I extract the last line that matches 'Export'. This question helps with the regex
for the last occurrence but I'm still not getting my desired results.
Desired Results
1,[27-SEP-12] NOT for export
2,[27-SEP-12] OK for export
Upvotes: 0
Views: 1870
Reputation: 23757
select
customer_id,
regexp_substr(exp_comment,'.*'||chr(10)||'(.*Export)', 1, 1, 'n', 1) as export
from export_comments
Upvotes: 2