Asp C# Regex for alphabet characters only

Here is a label which contains alphanumric and special characters.

 

 

 

Now to use Regex in asp .net we need to add Namespace

using System.Text.RegularExpressions;


Using asp c# code behind

        //==== Create Regex object and pass pattern.
        Regex reg = new Regex(@"[^a-zA-Z]");

        //===== Read Label value and replace all non alphabet characters with '-'
        string str = reg.Replace(lblValue.Text, "-");

        //==== Show output.
        Response.Write(str);

 

Output :

Asp .Net Regex for characters only

 
We are nothing without our users ! You can help us offer even more high quality content. Please share our page !
Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
6 + 1 =
 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2017 CodingFusion