Monday, May 7, 2012

Remove particular pattern from string


Following code can be used to remove any specific type of patterns (eg.html tags) from a given string.

Eg.  string outPutString = System.Text.RegularExpressions.Regex.Replace(inputString(eg. html of a page), "<[^>]*>", string.Empty).

<[^>]*>: is used to remove html tags. Here another patterns can also be added to remove it from particular strings.

Friday, February 10, 2012

Call server side method with JQuery

http://aspsnippets.com/Articles/Check-UserName-Availability-in-ASP.Net-using-JQuery.aspx

Replace special characters.

Using following pattern to replace the special characters of string with empty values:
temp.replace(/[^a-zA-Z 0-9]+/g,'');