LAMP Interview Questions
Collection of Linux, Apache, Mysql and Php Interview Questions
Thursday, August 1, 2013
Write a Regular expression to validate a url in php
if (preg_match('/^(http|https)://([A-Z0-9][A-Z0-9_-]*(?:.[A-Z0-9][A-Z0-9_-]*)+):?(d+)?/?/i', $url)) {
echo "Your url is ok.";
} else {
echo "Wrong url.";
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment