I have a form with a textarea field. User inputs item in this list like this
* first item in list
* second item in list
Free text not in list
I would like this to be output where the asterix is converted to an bullet list. and the text without asterix is not in the bulleted list.
like:
- first item in list
- second item in list
Free text not in list
Have tried:
$text = preg_replace("/\-+(.*)?/i","<li>$1</li>",$input);
$output = preg_replace("/(\<\/ul\>(.*)\<ul\>*)+/","",$text);
But i'm struggling to get my head around the preg_replace(), and tried to search for better solutions. So this code i found is not working.