Match Group Value : Regex Group : Regular Expression C# Examples


C# Examples » Regular Expression » Regex Group »

 

Match Group Value









    
using  System;
using  System.Collections.Generic;
using  System.Globalization;
using  System.Text;
using  System.Text.RegularExpressions;
using  System.Reflection;

public  class  MainClass{

      public  static  void  Main(){
                Regex  r  =  new  Regex(@"<([^>]+)>([^<]*)</(\1)>");
                Match  m  =  r.Match("<M>S</M>");
                Console.WriteLine("Tag:  {0},  InnerText:  {1}",  m.Groups[1].Value,  m.Groups[2].Value);
      }
}
    
   
  
   



Output

Tag: M, InnerText: S


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Regular Expression
» Regex Group