Re: Negative Look Ahead Regex - Code Mistake or Bug?

From: Date: Mon, 18 Aug 2008 02:52:06 +0000
Subject: Re: Negative Look Ahead Regex - Code Mistake or Bug?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-278259@lists.php.net to get a copy of this message
Hi Ash, > As far as I can tell, you have an error in your syntax. You're using a - > (hyphen) character in the first match, but Regex uses this to define a > range of characters. It seems that if you don't escape it, the whole > thing behaves a little strangely. For example, using your URL as the > source string: > > > http://www.domain.com/path1/path2.php?PHPSESSID=2u0ccaffoh6jaeapkke35qpp87; > > This regular expression > /^(http:\/\/www\.domain\.com([\/\.\-\_\w]*))/ > matches > [!MATCH!]?PHPSESSID=2u0ccaffoh6jaeapkke35qpp87; Thanks for your reply. I updated the code at the URL below adding your suggestion, but it doesn't seem to make a difference. http://www.kottmann.com/test.php Even if there is a problem with the meta characters, I don't understand how or why the SID would be added in between the .ph and the p in the extension. It's just totally bizarre to me and is why I'm wondering if it's a bug. (See links 1 & 8 by viewing source at the link above) You or anyone have other ideas to try? Thanks, Cameron

« previous php.general (#278259) next »