Jump to content

regex


dezkit

Recommended Posts

heres another example (will only match what you asked)

<?php
$url = "http://www.xxxxx.com"; //will work
$url = "http://www.blar1234.com"; //will work
$url = "http://www.xxxxx.coms"; //will fail
$url = "http://www.xxxxx.com test"; //will fail
$url = "test http://www.xxxxx.com"; //will fail

if (preg_match('%^http://www\.\w+\.com$%i', $url))
{
echo "Valid http://www.DOMAIN.com";
}


?>

Link to comment
https://forums.phpfreaks.com/topic/118171-regex/#findComment-608239
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.