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 Quote 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" Quote 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"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/118171-regex/#findComment-608239 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.