Hi,
I'm trying to code a regexp to convert a block of text:
* List item
* Another list item
to html:
<ul>
<li>List item</li>
<li>Another list item</li>
</ul>
I know there are snippets or classes to do this (Markdown, Textile, etc) but I think it's overkill: I really just want some basic functionality. So far I'm trying with:
$text = preg_replace("/\*+(.*)?/i","<li>$1</li>",$text);
But I don't know how to wrap everything in <ul> tags without using a separate replace, like so:
$text = preg_replace("/(\<li\>(.*)\<\/li\>\n*)+/is","<ul>\n$1\n</ul>\n",$text);
This interferes with other code, for example ordered lists. There must be a better way.
Thanks.