ID:               38135
 Updated by:       [EMAIL PROTECTED]
 Reported By:      msn at t-network dot nl
-Status:           Open
+Status:           Bogus
 Bug Type:         PCRE related
 Operating System: Windows XP SP2 Home Edition
 PHP Version:      5.1.4
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------

[2006-07-18 17:56:31] msn at t-network dot nl

Description:
------------
It's not possible to use the $n style backreference in the pattern of
the PCRE functions.

A pattern like this:

/\[(u|b|i|s)\](.*)\[\/$1\]/si

Should match [b]bold[/b]. However, it does not.
This pattern though:

/\[(u|b|i|s)\](.*)\[\/\\1\]/si

_Will_ match [b]bold[/b].

Reproduce code:
---------------
<?php

function parseUBB($sString)
{
        
        // Bold, underline, italic and strike tags
        $sString = preg_replace("/\[(u|b|i|s)\](.*)\[\/$1\]/si",
"<$1>$2</$1>", $sString);
        
        return ($sString);
}

echo parseUBB("[b]testb[/b], [u]testu[/u], [i]testi[/i]");

?>

Expected result:
----------------
<b>testb</b>, <u>testu</u>, <i>testi</i>

Actual result:
--------------
[b]test[/b], [u]testu[/u], [i]testi[/i]


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38135&edit=1

Reply via email to