Skip to content

Tag Archives: Regular Expressions

Developing simple Windows 7 Gadget – Part 1

24-Feb-10

Gadgets are simple and lightweight applications, which can be developed using HTML, Javascript and CSS. Gadgets can also include Image files. In Windows Vista, we can create Gadgets by zipping the files, and rename the it with .Gadget extension. In Windows 7 we can create Gadget by creating the .Gadget folder in C:\Program Files\Windows Sidebar\Gadgets\ [...]

How to validate email addess in Windows Forms

24-Mar-09

Today I want to add validation for email address in a Windows Forms application. I searched google, but didn’t got any simple solution. Then I tried with ASP.Net regex validation control and took the validation expression from it used in RegEx class.
Here is code

static bool IsValidEmail(string Email)
{
Regex regex = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
return regex.IsMatch(emailAddress);
}

Happy Coding [:)]
Share/Save

Regular expression to remove HTML tags in VB.Net

19-Apr-07

Some time we may need to strip all the HTML tags from HTML files, like if we are doing some web scrapping. Here is simple Regular expression which will remove all the HTML Tags.

Public Sub RemoveHTMLTags(ByVal expression as string) as string
Dim pattern As String = "<(.|\n)*?>;"
Return System.Text.RegularExpressions.Regex.Replace(strHtmlString, pattern, String.Empty).Trim()
End Sub

Share/Save