new Regex(?(^\d)^\d+$|^\D+$) : Regular Expression : Regular Expression C# Examples


C# Examples » Regular Expression » Regular Expression »

 

new Regex(?(^\d)^\d+$|^\D+$)









    
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(@"(?(^\d)^\d+$|^\D+$)");

                Console.WriteLine(r.Match("cat  too"));
                Console.WriteLine(r.Match("dag"));
                Console.WriteLine(r.Match("2else"));

      }
}
    
   
  
   



Output

cat too
dag


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Regular Expression
» Regular Expression