IP address : Regular Expression : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » Regular Expression »

 

IP address








    
 

using System;
using System.Text.RegularExpressions;


class RXassemblyApp {
    static void Main(string[] args) {
        string s = "123.45.67.89";
        string e =
            @"([01]?\d\d?|2[0-4]\d|25[0-5])\." +
            @"([01]?\d\d?|2[0-4]\d|25[0-5])\." +
            @"([01]?\d\d?|2[0-4]\d|25[0-5])\." +
            @"([01]?\d\d?|2[0-4]\d|25[0-5])";
        Match m = Regex.Match(s, e);
        Console.WriteLine("IP Address: {0}", m);
        for (int i = 1; i < m.Groups.Count; i++)
            Console.WriteLine(
                "\tGroup{0}={1}", i, m.Groups[i]);
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» Regular Expression