MatchEvaluator: Entry Point IP Reverse : Matcher « Development Class « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » Development Class » MatcherScreenshots 
MatchEvaluator: Entry Point IP Reverse
MatchEvaluator: Entry Point IP Reverse


using System;
using System.Text;
using System.Text.RegularExpressions;

public class EntryPoint
{
    static void Mainstring[] args ) {

        // Create regex to search for IP address pattern.
        string pattern = @"(?<part1>[01]?\d\d?|2[0-4]\d|25[0-5])\." +
                         @"(?<part2>[01]?\d\d?|2[0-4]\d|25[0-5])\." +
                         @"(?<part3>[01]?\d\d?|2[0-4]\d|25[0-5])\." +
                         @"(?<part4>[01]?\d\d?|2[0-4]\d|25[0-5])";
        Regex regex = new Regexpattern );
        Match match = regex.Match"192.168.169.1" );

        MatchEvaluator eval = new MatchEvaluator(EntryPoint.IPReverse );
        Console.WriteLineregex.Replace("192.168.169.1", eval) );
    }

    static string IPReverseMatch match ) {
        Console.WriteLinematch.Groups["part4""." );
        Console.WriteLinematch.Groups["part3""." );
        Console.WriteLinematch.Groups["part2""." );
        Console.WriteLinematch.Groups["part1"] );
        return "";
    }
}

           
       
Related examples in the same category
1.Use regular to search an IP addressUse regular to search an IP address
2.Match IP address pattern and print out the indexMatch IP address pattern and print out the index
3.Is Match successfulIs Match successful
4.Match GroupsMatch Groups
5.Define multiline patternsDefine multiline patterns
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.