Blog

Check Regular Expression In C# Language

By Arvind Pradhan Blogs | C# Language Sep 13, 2013
In this blog you will learn about using regular expression with example

Introduction

A regular Expression is a string pattern , which is provide to .Net framework check the string such as matching character , operators and other operations of string check.

Example

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Text.RegularExpressions;  //use library file

 

 

namespace check_regular_expraction_in_c_sharp

{

    class check

    {

        private static void Match(string s, string e) //create function to check conduction of string

        {

            MatchCollection test = Regex.Matches(s, e);  

            foreach (Match m in test)

            {

                Console.WriteLine(m);

                Console.WriteLine("\t");

            }

        }

        static void Main(string[] args)

        {

            string str = "Mister Smit is a member of parliament.He is a honest man"; //string , that is check

 

            Console.WriteLine("Matching words that start with small 'm':\n ");

            Match(str, @"\bm\S*");                                                 //pass value which is check

           

        }

    }

}


Output


output.jpg


COMMENT USING