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

What is an interpolation in perl?

561


How can the user execute a long command repeatedly without typing it again and again?

506


What is perl I used for?

531


How to create a package?

526


What is the different between array and hash in perl programming?

516






How do I sort a hash by the hash key?

571


How do I debug a perl program?

520


What does delete function do in perl?

520


Mention the difference between die and exit in Perl?

659


Explain the execution of a program in perl.

506


How to convert strings into an array in perl?

517


Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical?

526


Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?

541


What is a chop() function in perl?

575


How to access parameters passed to a subroutine in perl?

543