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.