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 |
Show the use of sockets for the server and client side of a conversation?
Create a function that is only available inside the scope where it is defined ?
How can you replace the characters from a string and save the number of replacements?
How we can navigate the xml documents?
What do the symbols $ @ and % mean when prefixing a variable?
Write a program that explains the symbolic table clearly.
What are numeric operators in perl?
Explain perl.
Give an example of the -i and 0s option usage.
Which functions in Perl allows you to include a module file or a module and what is the difference between them?
There are two types of eval statements i.e. Eval expr and eval block. Explain them.
How to convert strings into an array in perl?