Regex.IsMatch : Regex « System.Text.RegularExpressions « C# / C Sharp by API






Regex.IsMatch

 

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+");
        
        
        string[] ss = new string[] { "123abc", "abc123", "123", "abc", "a123bc" };

        foreach (string s in ss)
           Console.WriteLine(r.IsMatch(s));
   }
}

   
  








Related examples in the same category

1.new Regex(String pattern)
2.Regex.CompileToAssembly
3.Regex.Match(String value,String pattern).Success
4.Regex.Replace
5.Regex.Match
6.Regex.Split