Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a simple regular expression to match an IP address,
e-mail address, city-state-zipcode combination.

Answer Posted / jayakumar.b

sub validate_ip {

my $ip = shift;

if ( $ip =~ m/^([1-9]|1[0-9]{1,2}|2[0-4]\d|25[0-5])(\.([0-9]|1[0-9]{1,2}|2[0-4]\d|25[0-5])){3}$/ ) {
return 0;
} else {
return 1;
}
}

validate_ip("127.0.0.1");

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the reasons that cookie server can’t handle multiple connections?

949


What is goto statement in perl?

942


What is perl push array function?

953


you are required to replace a char in a string and store the number of replacements. How would you do that?

930


how to get back up from private character editor which is saved in the format of .udf

2298


How and what are closures implemented in perl?

898


Demonstrate subroutines in perl with a simple example.

864


Explain the difference between "my" and "local" variable scope declarations. ?

1076


You want to print the contents of an entire array. How would you do that?

980


Perl regular expressions are greedy" what does this mean?

929


When do you use perl programming?

1005


What is perl pop array function?

953


I have one question regarding to eval function. I know eval function is use for error checking but I am not able to understand below line. eval \'exec perl -S $0 ${1+\"$@\"}\' if 0; $0 for script name $@ set if error occur

2048


What is the usage of -i and 0s options?

1000


Explain gmtime() function in perl?

981