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 to How could i achieve this in C#.NET.

Could anybody help?

Thanks in advance..
LVL 36
Loganathan NatarajanLAMP DeveloperAsked:
Who is Participating?
ddrudikConnect With a Mentor Commented:
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:
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.
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.
Thanks for the question and the points.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.