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

Answer Posted / treddy

Hi all,
Here is the regular expression for matching the valid ip
address.
^(25[0-5]|2[0-4]{0,1}[0-9]{0,1}|1[0-9]{1,2}|[0-9]{1,2})[.](25[0-5]|2[0-4]{0,1}[0-9]{0,1}|1[0-9]{1,2}|[0-9]{1,2})[.](25[0-5]|2[0-4]{0,1}[0-9]{0,1}|1[0-9]{1,2}|[0-9]{1,2})[.](25[0-5]|2[0-4]{0,1}[0-9]{0,1}|1[0-9]{1,2}|[0-9]{1,2})$

Let me know your comments.

Thanks,
TReddy

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to create a directory in perl?

616


What are the various flags/arguments that can be used while executing a perl program?

535


Write a program to download the contents from www.perlinterview.com/answers.php website in Perl.

620


What is the main function of cookie server?

599


What is perl scripting?

589






how to extract pin_code,phone_number,year from text file using regular expressions in perl

1929


How and what are closures implemented in perl?

562


What is the peculiarity of returning values by subroutines in perl?

558


How many data types are there in perl?

609


What are the advantages of c over Perl?

607


What are the various perl data types based on the context?

618


Explain arrays in perl.

599


What is boolean context?

630


What does length(%HASH) produce if you have thirty-seven random keys in a newly created hash?

662


Which functions in Perl allows you to include a module file or a module and what is the difference between them?

609