[PHP] preg_replace spatie (opgelost!)

Gestart doorBasDev3 reacties38 weergaven

4 berichten · pagina 1 van 1

BasDev

Lid · Topicstarter

Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoi,

Na heel lang google hebben doorgezocht en alles te proberen is het me nog niet gelukt..
Ik probeer dit te krijgen:
[quote user=Bas post=3]lalalalalalala[/quote] bijv.

Maar.. hoe kan ik dat nou doen met preg_replace?


Inmiddels opgelost met dit als resultaat:

[COLOR= #0000BB]<?php[/COLOR]
    [URL="http://www.php.net/private"]private[/URL] [URL="http://www.php.net/static"]static[/URL] [COLOR= #007700]function[/COLOR] ParseQuotes[COLOR= #007700]([/COLOR][COLOR= #0000BB]$string[/COLOR][COLOR= #007700])
    {[/COLOR]
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/preg_match"]preg_match[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"([QUOTE](.+?)[/quote])ms"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$string[/COLOR][COLOR= #007700]))
        {[/COLOR]
            [COLOR= #0000BB]$quote[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]<fieldset><legend><strong>{1}</strong> {2}</legend><div class="in">{3}</div></fieldset>[/COLOR][COLOR= #007700];[/COLOR]
            
            [COLOR= #0000BB]$string[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"([QUOTE](.+?)[/quote])ms"[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"{1}"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"$1 schreef"[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"{2}"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000](<a href="/forum/go_to_post?id=$2">Ga naar bericht</a>)[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"{3}"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"$3"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$quote[/COLOR][COLOR= #007700]))),[/COLOR] [COLOR= #0000BB]$string[/COLOR][COLOR= #007700]);
        }[/COLOR]
        
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$string[/COLOR][COLOR= #007700];
    }[/COLOR]
?>


Bas
0
Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Waarom preg_replace en niet gewoon   ?
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wouterp schreef:
Waarom preg_replace en niet gewoon   ?
Waar heb jij het over?
0
BasDev

Lid · Topicstarter

Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wouterp schreef:
Waarom preg_replace en niet gewoon   ?
Omdat ik bezig ben met een UBB Parser die gewoon spaties in een UBB Tag ondersteund emo
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren