Using "System.Text.RegularExpressions" in C# you have a lot of abilities to work with text. One of practice of using System.Text.RegularExpressions is working with IP addresses.

For examples I’ll use this string:

network-plan: PART 256 16/60/240 8 PRI dial up modems network-plan: PART 256 0/60/240 8 PRI dial up modems network-plan: YES 64 10/16/35 LAN -mail and DNS servers network-plan: YES 64 15/25/40 LAN -NOC & Ops management network-plan: YES 16 5/11/11 LAN -Name based web hosting network-plan: YES 16 0/8/8 LAN -DNS servers network-plan: YES 16 4/6/12 loopback router interfaces

Start data:

Get the first IP address:

Get the first IP address after 50 symbol:

Get all IP addresses:

Masks are here too because they also match our Regular expression.