Page 2 of 2

Re: Am I doing something wrong?

Posted: Tue May 27, 2008 5:00 am
by prometheuzz
GeertDD wrote:...
One more argument to go for the strpos() check instead of trying to make the regex do all the work. ...
Couldn't agree more with you!

Re: Am I doing something wrong?

Posted: Tue May 27, 2008 8:41 am
by nirali35
Thanks a lot guys :)
I have solved the problem, and more importantly, I have learned many *good* things!! :)
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';