is there a function or regex or anything to group items by a {
and }
tag? so it should group items by the opening tag { and the closing tag }. but be careful, there are also groups inside parent groups like so:
group {
text1
group2 {
text2
}
}
so basically think of it like php, you make an opening tag, you need to close it with a closing tag, curly braces in php's case.
i just need it to like substr()
each group into an associative array somehow, except I cant figure it out with the whole, "group inside a parent group".
Edit: im trying to make my own syntax highlighter for learning purposes, and i thought grouping would be best. yes i know there is a php function for highlighting but... this is for educational purposes