Write a simple regular expression to match an IP address,
e-mail address, city-state-zipcode combination.
Answers were Sorted based on User's Feedback
Answer / anshuman
/^([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/
All those above answer are wrong...because all of them take
0.0.0.0 as valid IP address which is not the case...with computer science ...
Developed By Anshuman sengupta
Reviewed by Arnab Bose
Tested by Avishek chatterjee
| Is This Answer Correct ? | 1 Yes | 7 No |
Answer / raghav
For IP Address
/([0-255])(\.)$1\1$1\1$1/;
For other question answer may vary depending on the
requirement.
| Is This Answer Correct ? | 22 Yes | 31 No |
Answer / gopal
I hope this is the right way to match IP address
/((\d{1,3})(\.)){3}\d{1,3}/
| Is This Answer Correct ? | 12 Yes | 24 No |
What is the difference between die and exit in perl?
What is the purpose of goto expr statement?
What is an interpolation in perl?
What is the use of now constructor in perl?
What are the steps involved in configuring a server using cgi programming?
What are the logical operators used for small scale operations? Explain them briefly.
Explain about the applications of perl?
write a script to check whether user enter a value is a leap year or not?
3 Answers Oracle, Persistent, ViPrak,
Explain returning values from subroutines?
What is automatic error handling in perl?
There is no strict data types in perl unlike in other high level languages like Java so wouldn't that be a problem if a code in perl is to be a written by a big team of 20+ members ?"
Why Perl aliases are considered to be faster than references?