dezkit Posted August 4, 2008 Share Posted August 4, 2008 im in need of a (regex) script at which when a person submits a form, the value has to be "http://www.xxxxx.com" xxxxx meaning any letter or number Link to comment https://forums.phpfreaks.com/topic/118171-regex/ Share on other sites More sharing options...
lemmin Posted August 4, 2008 Share Posted August 4, 2008 Like this? "http://\..+?\.com" Link to comment https://forums.phpfreaks.com/topic/118171-regex/#findComment-608076 Share on other sites More sharing options...
MadTechie Posted August 5, 2008 Share Posted August 5, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.