I'm trying to extract certain data from LookML, a specific markup language. If this is example code:
explore: explore_name {}
explore: explore_name1 {
label: "name"
join: view_name {
relationship: many_to_one
type: inner
sql_on: ${activity_type.activity_name}=${activity_type.activity_name} ;;
}
}
explore: explore_name3 {}
Then I would receive a list looking like:
explore: character_balance {}
label: "name" join: activity_type { relationship: many_to_one type: inner sql_on: ${activity_type.activity_name}=${activity_type.activity_name} ;; }```
explore: explore_name4 {}
Essentially, I start a match at "explore" and end it when I find another "explore" - which would then begin the next match.
Here's what I had before, which matches across all the lines until it finds a ;
, and this works perfectly fine: 'explore:\s[^;]*'
. But, this stops at a ';', assuming there is one.
How would I change this so that it takes out everything between 'explore' and 'explore'? Simply replacing the ';' in my regex with 'explore' instead stops whenever it finds a letter that matches anything in [e,x,p,l,o,r,e] - which is not the behavior I want. Removing the square brackets and the ^ ends up breaking everything so that it can't query across multiple lines.
What should I do here?