looking for preg match url for this type of link http://www.netload.in/dateiKg9FSJML5m.htm http://netload.in/dateieaae4f6c0ca5cce45152b50f4c86d481/dnb-dl.part7.rar.htm So far i have made this but did not suceeded } elseif (eregi("http:\/\/netload\.in\/datei([0-9a-zA-Z]+)\/",$link)) { or } elseif (eregi("http:\/\/www\.netload\.in\/datei([0-9a-zA-Z]+)\/",$link)) { PHP:
emm.. there both the same link, I mean the end result is the same ? Anyway could you explain a little more, like whats the purpose, do you need to get something from the link etc... either way this little code will test for a match or not. <?php $link = ""; if (eregi("http://netload.in/datei(.*).htm",$link)) { echo "Its a match"; } else { echo "No match found"; } ?> PHP:
<?php $url = 'http://netload.in/dateieaae4f6c0ca5cce45152b50f4c86d481/dnb-dl.part7.rar.htm'; if (preg_match('~http://(www\.)?netload\.in/datei.+?\.htm~i', $url)) { echo 'Valid'; } else { echo 'Invalid'; } ?> PHP:
Stay away from everything that begins with ereg*... it's very very insecure, and deprecated. Be careful with the regex above. It would allow users to insert HTML in the URL, so filter it properly before outputting it to your users (if that's the plan anyway).
If the OP is not displaying (ie. echo or print) the URL, then its okay...however if the OP is then filter it via htmlspecialchars()