I'm trying to write a php script which will phrase out valid links from a file. all the links have jl.cgi/xxx where xxx is numbers. I use the following regex below which works but it also give me a bunch of links that don't match the criteia. preg_match_all("/http:\/\/(.+?)\/jl.cgi\/\d+/im", $data, $scraped); so I want to scrape http://www.xxx.com/jl.cgi/123
Seems fine to me, the only thing I'd change is: preg_match_all("/http:\/\/(.+?)\/jl\.cgi\/\d+/im", $data, $scraped); Notice the '\' in from the dot in '.cgi' - other than that I can't see anything wrong... What unwanted results are you getting? I mean, how are those links?