What I want is to end up with an @array with List 1 in $array[0] and List 2 in $array[1]. The sub items is what is tripping me up.<ul> <li> List 1 Item 1 <li> List 1 Item 2 <ul> <li> Sub-Item 1 <li> Sub-Item 2 </ul> <li> List 1 Item 3 </ul> <ul> <li> List 2 Item 1 <li> List 2 Item 2 <ul> <li> Sub-Item 1 <li> Sub-Item 2 </ul> <li> List 2 Item 3 </ul>
Right now I am splitting the string on line breaks and using a foreach loop to find and skip nested items and push them into respective array elements.
My question is: Can I accomplish this same thing with a single regex?
Thanks for your help!
--Rod
In reply to Regex Nested Matching by Rodster001
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |