Regex for recursive "wiki-style" lists
- by Syd Miller
I'm trying to create a Regular Expression to match "wiki style" lists as in (using preg_replace_callback() ):
* List Item 1
* List Item 2
*# List Item 2.1
*# List Item 2.2
* List Item 3
Asterisks denote Unordered Lists while Number-Signs denote Ordered Lists. I'm trying to get this so it can match infinite depth and so that * and # can be mixed.
I tried the following expression (and variations of it): /\s([*#]{1,}) ([\S ]+)\s/si
But it doesn't seem to want to work.
What am I doing wrong? Or is there a better way of accomplishing this?