Write a simple regular expression to match an IP address,
e-mail address, city-state-zipcode combination.
Answer Posted / saravanan
$ip="0.25.55.25";
if($ip=~/([0-2]{0,1}[0-5]{0,2})\.([0-2]{0,1}[0-5]{0,2})\.([0-2]{0,1}[0-5]{0,2})\.([0-2]{0,1}[0-5]{0,2})/){
print $ip;
}
This will match for all ip address
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What does the’$_’ symbol mean?
How to disable the mod_perl from apache_server as i have used perlfect search on the site and its pagination is not working and the remedy is to disable the mod_perl.
How does polymorphism work in perl?
Explain 'grep' function.
Is perl a case sensitive language?
How to determine strings length in perl?
What are the two ways to get private values inside a subroutine?
What are the different types of perl operators?
What does the qq{ } operator do?
Explain perl. When do you use perl for programming? What are the advantages of programming in perl?
Explain the meaning of subroutine?
What are the various file operations in perl. Explain with example.
Differentiate between arrays and list in perl.
What is 'rollback' command in perl?
Give an example of using the -n and -p option.