I have a multiline text, structured like a windows .INI file (with sections enclosed in square brackets and pairs of keys and values).
I want to search for a particular section and return the line next to that section, that is the first line of values.
example:
[Planets]
Moon=30
Sun=34
[Animals]
Lion=564
Mouse=34
So, if I search for "[Planets]" I want the first line: "Moon=30".
If I search for "[Animals]" I want "Lion=564".
I believed to use the regexp_substr function, with two section, multiline, and return the second occurrence, but it fails.
Here is what I've done:
select regexp_substr(myText,'(\[Planets\].*$)(.*)',1,1,'m',2)
from myTable
What I have to do?
Thank you in advance.