How do i generate Ip addresses from Regular Expression

I am getting Regular Expression as an input for IP Address. ex. 192.168.(2[0-4]\d|25[0-5]|[01]?\d\d?).\.(2[0-4]\d|25[0-5]|[01]?\d\d?). Having this, i need to generate list of IP Addresses starting from 192.168.1.1 to 192.168.254.254. How could i achieve this in C#.NET.

Could anybody help?

Thanks in advance..
LVL 36
Loganathan NatarajanLAMP DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ddrudikCommented:
You would need to loop through the target addresses to test each one against your pattern to determine a match.  Another option would be to have all IP addresses in a text file in which you match each line against the pattern.  There really isn't a simple function to do this well that I am aware of, what is the goal?

Note that . chars need to be escaped in regex patterns, as you did in one place but not the others, also in the one place where you did escape the . you seem to have an extra unescaped . before it.
0
Loganathan NatarajanLAMP DeveloperAuthor Commented:
I am doing a program that will fetch the name of the computers available over a network. In order to get the computer name i need to provide the Ip address. There are many subnets available over the network. It is very difficult to enter all the IP addresses.
So, i thought i could use Regular Expression to avoid this difficulty.
I thought this could be generalized and used for any network.
0
ddrudikCommented:
I would recommend you consider a pre-made module for this, if you can intergrate Perl in your solution there are subnet and IP matching modules available:
http://search.cpan.org/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ddrudikCommented:
Thanks for the question and the points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.