i want to search most of the string the word google for examle a string that contains www.news.google.com/blah blah or www.images.googel.com/blah blah i want them to be excluded in my search so that i can find the real site i have here the coding whre $all_url[] array contains the links/url and i only want to display the link that doesnt start with number for example htt[://77787etc and links that does not contain any google in the string only the valid urls i wnat to display so can anyone help me simplify my coding? $x= $counter; while (++$x < 200){ $all_url_edit = $all_url[$x]; if ($all_url_edit >= 'http://a'){ $compare1 = strcmp(substr($all_url_edit,0,24),'http://images.google.com'); $compare2 = strcmp(substr($all_url_edit,0,23),'http://video.google.com'); $compare3 = strcmp(substr($all_url_edit,0,22),'http://news.google.com'); $compare4 = strcmp(substr($all_url_edit,0,24),'http://groups.google.com'); $compare5 = strcmp(substr($all_url_edit,0,21),'http://www.google.com'); $compare6 = strcmp(substr($all_url_edit,0,25),'http://adwords.google.com'); if ($compare1 != 0 && $compare2!=0 && $compare3!=0 && $compare4!=0 && $compare5 !=0 && $compare6 !=0){ //echo $compare; //echo "<a href='$all_url_edit' target=_blank>$all_url_edit</a>"; //echo "<br>"; $urls[] = $all_url_edit; } } }
im not sur wat u askin wih al teh mispelin and u culdnt be bothred to use punctutation so scrw u lazie sshol
Is this simple enough? It removes links starting with a number or if the URL is google.com or a subdomain of it. $x = $counter; while (++$x < 200) { if (preg_match('~http://(www\.)?([0-9]|(.+\.)?google\.com)~', $all_url[$x]) unset($all_url[$x]); } // $all_url is now an array with the unwanted URLs removed PHP: