Determines whether a string matches the given pattern. - CSharp System

CSharp examples for System:String Match

Description

Determines whether a string matches the given pattern.

Demo Code


using System.Text.RegularExpressions;
using System.IO;//from  w  w  w .  ja va 2s  .  co  m
using System.Collections.Generic;

public class Main{
        /// <summary>
		/// Determines whether a string matches the given pattern.
		/// </summary>
		/// <param name="Input">The string to check.</param>
		/// <param name="Pattern">The regular expression.</param>
		/// <returns>True if the string matches the pattern or false if not.</returns>
		public static bool IsMatch(this string Input, string Pattern) {
			Regex r = new Regex(Pattern);
			return r.IsMatch(Input);
		}
}

Related Tutorials