Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11097 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42283 invoked by uid 1010); 11 Jul 2004 19:07:20 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 42214 invoked from network); 11 Jul 2004 19:07:20 -0000 Received: from unknown (HELO sapo.pt) (212.55.154.22) by pb1.pair.com with SMTP; 11 Jul 2004 19:07:20 -0000 Received: (qmail 30782 invoked from network); 11 Jul 2004 19:07:19 -0000 Received: from unknown (HELO sapo.pt) (10.134.35.155) by relay2 with SMTP; 11 Jul 2004 19:07:19 -0000 Received: (qmail 32152 invoked from network); 11 Jul 2004 19:05:51 -0000 Received: from unknown (HELO pc07653) (nunoplopes@sapo.pt@[82.154.18.243]) (envelope-sender ) by mta5 (qmail-ldap-1.03) with SMTP for ; 11 Jul 2004 19:05:51 -0000 Message-ID: <003501c4677a$57d75f60$0100a8c0@pc07653> To: "Michael Spector" , "PHPdev" References: Date: Sun, 11 Jul 2004 20:07:42 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Subject: Re: [PHP-DEV] Bug in preg_match() ? From: nlopess@php.net ("Nuno Lopes") > Hi, > > This script: > > $line = "Use operator m// for matching strings"; > $pattern = "m//"; > > if(preg_match("/$pattern/", $line, $match)) { > print $match[0]."\n"; > } > ?> There is no bug here! The final pattern is "/m///". When using // as delimeters, you must escape them, so you would need to set $pattern="m\/\/" *or* using other delimeter such as '~': preg_match("~$pattern~",...) Nuno