[Resolved] Creating a [list] tag?
I'm creating some sort of bbcode for one of the projects I'm working on, and am running into a bit of trouble with a [list] tag.
The list tag was supposed to look like this:
[list=#]
[*]ListItem
[/list]
Where # is the type of list.
This is what I started with:
Code:
$tags = array("/\[list=1\](.*)\[\/list\]/siU", "/\[list=2\](.*)\[\/list\]/siU",
"/\[list=3\](.*)\[\/list\]/siU", "/\[\*\](.*)/siU");
$html = array("<ol>\\1</ol>", "<ol type=\"a\">\\1</ol>",
"<ul>\\1</ul>", "<li>\\1");
$msg = preg_replace($tags, $html, $msg);
Now, since I also run nl2br() on the $msg, it replaces newlines with <br /> tags. So my list ends up looking like this:
Code:
<ol><br />
<li>Testing<br />
<li>The<br />
<li>Numbered<br />
<li>List</ol><br />
The <br />'s in there create a lot of problems with spacing and margins.
So my question is: how can I remove the newlines with my expression?