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 do you mean by context of a subroutine?
How to know whether a key exists or not in perl?
Explain '->' in perl?
Explain arrays in perl.
Which operator in perl is used for the concatenation of two strings?
How are parameters passed to subroutines in perl?
What is the use of now constructor in perl?
What are the reasons that cookie server can’t handle multiple connections?
What package you use to create a windows services?
Explain goto label?
How will you create a file in perl?
How to read a single line from a file in perl?
What is Perl?
What is perl I used for?
What is the difference between single (') and double (") quote in a string in perl?