Re: Am I doing something wrong?
Posted: Tue May 27, 2008 5:00 am
Couldn't agree more with you!GeertDD wrote:...
One more argument to go for the strpos() check instead of trying to make the regex do all the work. ...
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Couldn't agree more with you!GeertDD wrote:...
One more argument to go for the strpos() check instead of trying to make the regex do all the work. ...
GeertDD wrote: Yeah, you are probably right. One more argument to go for the strpos() check instead of trying to make the regex do all the work. Why? Because you don't know for sure which part comes first within the query string: task or itemid? The regex would have to check both possibilities. Let me just quickly try to cook something up (not tested), just as an example of how ugly it gets.
Code: Select all
$regex = '/<a\s++href="([^"]*\b(?:task=view\b[^"]+\bitemid=123|itemid=123\b[^"]+\btask=view)\b[^"]*+)"[^>]*+>([^<]++)/i';