Write a simple regular expression to match an IP address,
e-mail address, city-state-zipcode combination.

Answer Posted / treddy

Hi all,
Here is the regular expression for matching the valid ip
address.
^(25[0-5]|2[0-4]{0,1}[0-9]{0,1}|1[0-9]{1,2}|[0-9]{1,2})[.](25[0-5]|2[0-4]{0,1}[0-9]{0,1}|1[0-9]{1,2}|[0-9]{1,2})[.](25[0-5]|2[0-4]{0,1}[0-9]{0,1}|1[0-9]{1,2}|[0-9]{1,2})[.](25[0-5]|2[0-4]{0,1}[0-9]{0,1}|1[0-9]{1,2}|[0-9]{1,2})$

Let me know your comments.

Thanks,
TReddy

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to print escaping characters inside a string in perl?

505


How to access parameters passed to a subroutine in perl?

529


What is perl dbi?

491


Explain what is STDIN, STDOUT and STDERR?

537


what are prefix dereferencer and list them out?

633






Enlist the advantages of using c over perl?

509


Explain the functioning of conditional structures in perl.

461


What are the arguments and what do they mean in perl programming?

517


How to replace perl array elements?

524


What $! In perl?

524


There are two types of eval statements i.e. Eval expr and eval block. Explain them.

477


Explain perl.

549


How to compare two strings in perl?

539


Explain the difference between declarations of 'my' and 'local' variable scope in perl?

493


What is the difference between exec and system?

552