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
How many data types are there in perl?
How to check the status of airplane mode (enable/disable) in perl for Android mobile?
What does next statement do in perl?
How can we create perl programs in unix, windows nt, macintosh and os/2 ?
How to connect with sqlserver from perl and how to display database table info?
How to deleting an existing file in perl programming?
What does delete function do in perl?
Why we use CGI?
When does circular reference occur?
What is the purpose of redo statement?
How to concatenate strings in perl?
What does 'do' statement do in perl?
Explain USE and REQUIREMENT statements?
Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.
How will you open a file in a write-only mode in perl?