|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-12-06 09:11 UTC] msopacua@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 15:00:01 2025 UTC |
Perhaps I am misunderstanding something about the differences between perl regex and php perl regex, but this looks like a bug to me. The back references are behaving strangely.. I think the following code demonstrates it fairly well. Removing the back reference from the preg_match code results in a successful match as expected. The following code fails in php 4.2.2: $string = "blah/blah/other/stuff/here.html"; if (preg_match("/^\/?([^\/]+\/)(\1)/",$string,$matches) ) { print "found match: $matches[1] <BR>\n"; } else { print "failed to match.. <BR>\n"; } in perl 5.x, it works fine: my $string = "blah/blah/other/stuff/here.html"; if ($string =~ /^\/?([^\/]+\/)(\1)/) { print "found match: $1 <BR>\n"; } else { print "failed to match.. <BR>\n"; } configure command: './configure' '--with-apxs=/usr/local/sbin/apxs' '--with-config-file-path=/usr/local/etc' '--enable-versioning' '--with-regex=system' '--without-gd' '--without-mysql' '--with-gd=/usr/local' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/local' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-zlib' '--with-bz2=/usr' '--with-mcrypt=/usr/local' '--with-mhash=/usr/local' '--with-mysql=/usr/local' '--with-openssl=/usr' '--with-expat-dir=/usr/local' '--with-xmlrpc' '--enable-xslt' '--with-xslt-sablot' '--enable-ftp' '--with-curl=/usr/local' '--with-gettext=/usr/local' '--with-iconv=/usr/local' '--enable-trans-sid' '--prefix=/usr/local' 'i386-portbld-freebsd4.6' Thanks for looking at this, earth earth_php@erowid.org