Dites les gens, il y en a qui font du php ici ? Parce que j'ai un problème 
En gros j'ai cette fonction :
##########
## BBcode
##########
function bb_parse($string) {
$bals = 'p|h1|h2|h3|ulist|olist|li|b|i|s|url|yt';
while (preg_match_all('`\[(' . $bals . ')=?(.*?)\](.+?)\[/\1\]`', $string, $matches)) foreach ($matches[0] as $key => $match) {
list($bal, $param, $text) = array($matches[1][$key], $matches[2][$key], $matches[3][$key]);
switch ($bal) {
case 'p': $replacement = '<p>' . $innertext . '</p>'; break;
case 'h1': $replacement = '<h1>' . $text . '</h1>'; break;
case 'h2': $replacement = '<h2>' . $text . '</h2>'; break;
case 'h3': $replacement = '<h2>' . $text . '</h2>'; break;
case 'ulist': $replacement = '<ul>' . $text . '</ul>';break;
case 'olist': $replacement = '<ol>' . $text . '</ol>';break;
case 'li': $replacement = '<li>' . $text . '</li>';break;
case 'b': $replacement = '<span class="bold">' . $text . '</span>'; break;
case 'i': $replacement = '<span class="italic">' . $text . '</span>'; break;
case 's': $replacement = '<span class="underline">' . $text . '</span>'; break;
case 'url': $replacement = '<a href="' . $param . "\">$text</a>"; break;
case 'yt': $replacement = '<iframe src="https://www.youtube.com/embed/' . ($text) . '" alt="' . $text . '" frameborder="0" allowfullscreen></iframe>'; break;
}
$string = str_replace($match, $replacement, $string);
}
return $string;
}
J'y entre via $string un texte en BBCODE. Mais quand j'entre un texte du style :
[ulist]
[li]Ce dimanche à 21h30 - Night Owl sur "Californium"/"DeathGoat"/"Blue Estate".[/li]
[li]Lundi à 23h00 - Globihorror sur "Layers of Fear".[/li]
[li]Mardi à 21h00 - Live sur un jeu mystère ou "Tomb Raider".[/li]
[li]Mercredi à 23h00 - Globiporn (c'est la joie).[/li]
[li]Jeudi à 21h00 - Globihorror sur "Layers of Fear" (ou un autre jeu si celui-ci est fini).[/li]
[li]Vendredi à 22h00 - Live sur un jeu mystère.[/li]
[li]Samedi à 23h00 - Live sur un autre jeu mystère.[/li]
[/ulist]
Au lieu de me retrouver avec :
<ul>
<li>Ce dimanche à 21h30 - Night Owl sur "Californium"/"DeathGoat"/"Blue Estate".</li>
<li>Lundi à 23h00 - Globihorror sur "Layers of Fear".</li>
<li>Mardi à 21h00 - Live sur un jeu mystère ou "Tomb Raider".</li>
<li>Mercredi à 23h00 - Globiporn (c'est la joie).</li>
<li>Jeudi à 21h00 - Globihorror sur "Layers of Fear" (ou un autre jeu si celui-ci est fini).</li>
<li>Vendredi à 22h00 - Live sur un jeu mystère.</li>
<li>Samedi à 23h00 - Live sur un autre jeu mystère.</li>
</ul>
Je me retrouve avec ça :
Je pense à un problème de regex. Je maitrise pas du tout le regex donc bon j'en chie pas mal ~:hap:~ Une âme charitable pour m'aider ? 