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

Answer Posted / arup

Below Solution is applicable IP only :

(/(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})/ && $1<256 &&
$2<256 && $3<256 && $4<256)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you replace the characters from a string and save the number of replacements?

514


Does Perl have reference type?

528


What is the use of "stderr()"?

571


In Perl we can show the warnings using some options in order to reduce or avoid the errors. What are that options?

591


Give an example of using the -n and -p option.

541






what is Perl one liner?

540


How will you declare a variable in perl?

547


Explain which feature of PERL provides code reusability?

735


Explain the execution of a program in perl.

506


How can you define “my” variables scope in Perl and how it is different from “local” variable scope?

627


Explain the different types of data perl can handle.

493


Explain string comparison operators in perl.

558


What does -> symbol indicates in Perl?

570


What is confess function in perl?

545


How do I print the entire contents of an array with Perl?

532