Stripping non-numeric characters from a string in C#

Posted: May 13th, 2011 | Author: | Tags: , , , | No Comments »

 

string output = Regex.Replace("String 2 Parse 4 Non Numerics", "[^0-9]", string.Empty)

In this case the variable “output” will hold the value “24″


Regular Expression to Strip HTML from String

Posted: July 12th, 2010 | Author: | Tags: , , | No Comments »

I used this in a simple reguar expression to strip html

/<(?:.|\s)*?>/g

An example of using this in a javascript function is as such…

function stripHtml(html)
{
    return html.replace(/<(?:.|\s)*?>/g, "");
}