untested:

preq_replace('/\[\*\]([^(\[\*\])(<\/ul>)]*)/i','<li>$1</li>',$text);



Jens Lehmann wrote:

Hi out there,

I encountered a lot of problems while trying to convert a list
in Forum-Code (like UBB-Code).

[list]
[*] item 1
[*] item 2
[*] item 3
[/list]

should be converted to

<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>

I converted the first one to

<ul>
[*] item 1
[*] item 2
[*] item 3
</ul>

Now I need a Regexp for converting every [*] foo to <li>foo</li>.

I started with

$text = preq_replace('/\[\*\]([^(\[\*\])]*)/i','<li>$1</li>',$text);

The RegExp starts from [*] and saves every char in $1 until [*]
occurs again. That's fine, but what I need is a RegExp which starts
from [*] and saves every char in $1 until [*] OR </ul> occurs in
$text. I tested a lot, but didn't find a solution. I'd be glad about
any help.

Jens









--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to