url and email validation using Perl Regular expression

#!c:/perl/bin/perl -w
print “Content-Type: text/html \n\n”;
$email=”tspradeepkumar\@yahoo.com”;
print $email;
if($email =~ /^(\w|\-|\_|\.)+\@((\w|\-|\_)+\.)+[a-zA-Z]{2,}$/i)
{
print “\n $email is a valid id”;
}
else
{
print “\n Provide a valid email id”;
}

$url=”http://www.eadhoc.com“;
print “\n $url \n”;
if($url =~ /^http:\/\/+(www)+\.+[a-zA-Z0-9\-]+\.+[a-zA-Z]{2,6}$/i)
{
print “$url is a valid url”;
}
else
{
print “\n Provide a valid url “;
}

Comments

Popular posts from this blog

Installing ns3 in Ubuntu 22.04 | Complete Instructions

How to Create Ubuntu 24.04 Bootable USB Using Rufus [Step-by-Step Guide]

Installation of NS2 in Ubuntu 22.04 | NS2 Tutorial 2