Hey, I'm trying to get some regex magic to work
I've got data heirarchically composed by
where <tabs> and <matching tabs> are an indeterminate, but matching, number of tab characters. Due to heirarchy, it's possible to have subsections nested (incrementing the number of tabs at each level).
I've written a function to take in the section name and return the whole section, but I can't figure out how to make it independent of the number of tabs. A non-greedy search will abort at the first subsection, and greedy will continue the length of the data.
I think the solution is akin to saying "count n tabs before ["section"] and then match n tabs at the end" but I don't know how to implement this.
I'm dealing with Perl-compatible, but can probably adapt another syntax.
I've got data heirarchically composed by
Code:
<tabs>["section"] = {
...
...
...
<matching tabs>}
I've written a function to take in the section name and return the whole section, but I can't figure out how to make it independent of the number of tabs. A non-greedy search will abort at the first subsection, and greedy will continue the length of the data.
I think the solution is akin to saying "count n tabs before ["section"] and then match n tabs at the end" but I don't know how to implement this.
I'm dealing with Perl-compatible, but can probably adapt another syntax.