Log in

View Full Version : vb3: Stripping other quote tags eg [quote2]


Mark.B
07-22-2004, 10:47 PM
<post removed due to stalkers>

Xenon
07-23-2004, 07:44 AM
open includes/functions.php

and find:
// ###################### Start strip_quotes #######################
function strip_quotes($text)
{
return preg_replace('#\[quote(=(&quot;|"|\'|).*\\2)?\]((?>[^\[]+?|(?R)|.))*\[/quote\]#siU', '', $text);
//return preg_replace('#\[quote(=(&quot;|"|\'|).*\\2)?\].*\[/quote\]#siU', '', $text);
}


and replace with:
// ###################### Start strip_quotes #######################
function strip_quotes($text)
{
return preg_replace(array(
'#\[quote(=(&quot;|"|\'|).*\\2)?\]((?>[^\[]+?|(?R)|.))*\[/quote\]#siU',
'#\[quote2(=(&quot;|"|\'|).*\\2)?\]((?>[^\[]+?|(?R)|.))*\[/quote2\]#siU',
'#\[quote3(=(&quot;|"|\'|).*\\2)?\]((?>[^\[]+?|(?R)|.))*\[/quote3\]#siU',
'#\[quote4(=(&quot;|"|\'|).*\\2)?\]((?>[^\[]+?|(?R)|.))*\[/quote4\]#siU'
), array('', '', '', ''), $text
);
}


that should work

Xenon
07-25-2004, 09:04 PM
that feels good :)

you're welcome.

CarCdr
07-25-2004, 09:45 PM
Not that it matters a whole lot, other than removing redundant code, but you could accomplish the same thing with a single regular expression:preg_replace(
'#\[quote(2|3|4|)(=($quot;|"|\'|).*\\3)?\]((?>[^\[]+?|(?R)|.))*\[/quote\\1\]#siU',
'', $text);