Codelog

foreach(Snippet aSnippet in CodeLog){ aSnippet.GetSolution(); }

Archive for the ‘Regex’ tag

Masked TextBox in C#

without comments

Masked TextBoxes are those that won’t allow (or that will allow) certain strings, numbers or characters or patterns. Such kind of control is already present in the C#.Net with the name MaskedTextBox. This tutorial will suggest another way of doing such a TextBox in simple steps.

We will be using Regex in this tutorial. Its suggested that you have a look at the keywords used in writing Regex patterns [ RegularExpressions ].
RegexPal is an online regex tester. Its really handy at times.

Follow these steps to get a custom made masked textbox. We will be using Regex for specifying the mask Read the rest of this entry »

Written by sudarsanyes

July 3rd, 2008 at 1:00 am

Posted in C#, Controls, Regex, UI

Tagged with , ,

Regular Expressions in C#

with one comment

RegularExpressions (AKA: Regex) are special strings that define a search pattern. Writing regex in C# is much similar to those you write in python. Some of the important keywords to be learnt before going in for Regex in C# are,

^ - denotes the start of the string
$ - denotes the end of the string
? - zero or one of the preceding element
* - zero or more of the preceding element
+ - one or more of the preceding element
\d - digits
\s - white space
Read the rest of this entry »

Written by sudarsanyes

July 2nd, 2008 at 2:17 pm

Posted in C#, Regex

Tagged with ,