No your right it is \1 it just didn't seem to copy correctly.
Can i put this question across differently??
Right then, i have a template that looks like this :
h1. Heading
h2. subheading
bq. blockquote
*sex
*drugs
*rock
*roll
a basic paragraph
And the current code i'm using to parse it looks like this.
function textParser ($text) {
// converts hn. text to <hn>text</hn>
$text = preg_replace ("/^h+([0-6])\.(.*)/m", "<h\\1>\\2</h\\1>", $text);
// converts bq. text to <blockquote>text</blockquote>
$text = preg_replace ("/^bq+\.(.*)/m", "<blockquote>\\1</blockquote>", $text);
// converts *text to <li></li>
$text = preg_replace ("/^\*(.*)/m", "<li>\\1</li>", $text);
// converts anything that doesn't start with either a bracket or space to <p>text</p>
$text = preg_replace ("/^([^<|[:space:]].*)/m", "<p>\\1</p>", $text);
echo $text;
};
But my problem lies where i need to preg_replace the * character for a <li> tag. How do i get it so it put's an <ul> tag just before the first <li> and </ul> at the end of the last </li>.
So instead of this :
<h1>Heading</h1>
<h2>SubHeading</h2>
<blockquote>blockquote</blockquote>
<li>sex</li>
<li>drugs</li>
<li>rock</li>
<li>roll</li>
I would get this :
<h1>Heading</h1>
<h2>SubHeading</h2>
<blockquote>blockquote</blockquote>
<ul>
<li>sex</li>
<li>drugs</li>
<li>rock</li>
<li>roll</li>
</ul>
It seems so simple yet i can't find out how to do it.