This is what I have so far:
<?php
$text = preg_replace('/((\*) (.*?)\n)+/', 'awesome_code_goes_here', $text);
?>
I am successfully matching plain-text lists in the format of:
* list item 1
* list item 2
I'd like to replace it with:
<ul>
<li>list item 1</li>
<li>list item 2</li>
</ul>
I can't get my head around wrapping <ul>
and looping through <li>
s! Can anyone please help?
EDIT: Solution as answered below...
My code now reads:
$text = preg_replace('/\* (.*?)\n/', '<ul><li>$1</li></ul>', $text);
$text = preg_replace('/<\/ul><ul>/', '', $text);
That did it!