Tag Archives: Regex

Masked Edit Control in C# using Regex

By Michael J. Bullard
We programmed a masked textbox control with C# that will convert the mask into a regular expression for each character in the field. It is designed to accept a user defined mask or a regular expression that defines each character in the field. If you pass it the mask as a string using [...]

Read more

C# Strings and Regular Expressions

3.0. Introduction
It would be very rare to create an entireapplication without using a single string. Strings help make sense ofthe seemingly random jumble of binary data that applications use toaccomplish a task. They appear in all facets of application developmentfrom the smallest system utility to large enterprise services. Theirvalue is so apparent that more and [...]

Read more

Regular Expressions in C#

 
The following example shows the usage of Regular Expressions in C#. Theprogram basically has all the Validation Programs using RegularExpression.
/*<howtocompile> csc /r:System.Text.RegularExpressions.dll,System.dll Validation.cs </howtocompile>*/
using System.Text.RegularExpressions;using System;
class Validation{ public static void Main() { string strToTest; Validation objValidate=new Validation();
Console.Write("Enter a String to Test for Alphabets:"); strToTest=Console.ReadLine(); //Change here to whatever validation you want to perform if(objValidate.IsAlpha(strToTest)) [...]

Read more