php - Regex link from google results -


i trying urls google results, google api doesn't allow getting more first 100 results, thought of copying google content, pasting file , using preg_match_all results. unfortunately not regular expressions.

can me this? main problem links not have "http://".

$body="php – wikipedia, wolna encyklopedia         pl.wikipedia.org/wiki/php‎         php jest najczęściej stosowany tworzenia skryptów po stronie serwera www, ale może być on również używany przetwarzania danych z poziomu ...         możliwości - historia - moduły - składnia         php: hypertext preprocessor         php.net/‎tłumaczenie strony         server-side html embedded scripting language. provides web developers full suite of tools building dynamic websites: native apis apache , ...         downloads - documentation - simple tutorial - news archive - 2012         php: downloads         php.net/downloads.php‎tłumaczenie strony         binaries other systems. not distribute unix/linux binaries. linux distributions come php these days, if not want compile ...         php tutorial - w3schools         www.w3schools.com/php/‎tłumaczenie strony         provides basic advanced php functions. users can learn how integrate php other languages such mysql, ajax, , xml.         kurs php         phpkurs.pl/‎         kurs programowania w języku php. kurs ten ma za zadanie zaznajomić osobę kompletnie nieobeznaną z tym językiem na tyle, aby sama była w stanie napisać ...         podstawy - operacje na plikach - ciągi znakowe (stringi) - tablice";     preg_match_all('/^(www\.)?[a-z0-9_\-]+.[a-z]+$/', $body, $match);  print_r($match); 

result:

 array ( [0] => array ( ) [1] => array ( ) ) 

can me fix it?

this match basic url patterns, , accept end of url. tested on example input , seems work want.

preg_match_all('/((?:(?!-)[a-z\d-]+[^-]\.)+[a-z]{2,6}.*)/', $body, $match) 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -