From:             yurtesen at ispro dot net dot tr
Operating system: FreeBSD 4.8-STABLE
PHP version:      4.3.3
PHP Bug Type:     PCRE related
Bug description:  * operator doesnt function as it is supposed to be

Description:
------------
If I have string
<a HREF="linkhere"><font>texthere</a></font>
I can extract the text 'linkhere' and 'texthere' with
preg_match_all("/<a.*href=\"(.*)\".*><.*>(.*)<\/a>/iU", $line, $matches);

But if the string is
<a HREF="linkhere"><font><b>texthere</a></b></font>
preg_match_all("/<a.*href=\"(.*)\".*>(?:<.*>)*(.*)<\/a>/iU", $line,
$matches);

doesnt work. It matches for "<font><b>texthere"
I am trying to exclude <font><b> by matching repeatedly by
(?:<.*>)* before the actual text I need.

You can check out my php configuration from
http://www.ispro.net/temp/phpinfo.php

Reproduce code:
---------------
<?
  $line = '<a HREF="linkhere"><font><b>texthere</a></b></font>';

  preg_match_all("/<a.*href=\"(.*)\".*>(?:<.*>)*(.*)<\/a>/iU", $line,
$matches);

  print_r($matches);

?>

Expected result:
----------------
Array
(
    [0] => Array
        (
            [0] => <a HREF="linkhere"><font><b>texthere</a>
        )

    [1] => Array
        (
            [0] => linkhere
        )

    [2] => Array
        (
            [0] => texthere
        )

)

Actual result:
--------------
Array
(
    [0] => Array
        (
            [0] => <a HREF="linkhere"><font><b>texthere</a>
        )

    [1] => Array
        (
            [0] => linkhere
        )

    [2] => Array
        (
            [0] => <font><b>texthere
        )

)

-- 
Edit bug report at http://bugs.php.net/?id=25618&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25618&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25618&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25618&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25618&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25618&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25618&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25618&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25618&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25618&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25618&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25618&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25618&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25618&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25618&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25618&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25618&r=float

Reply via email to