Just a quick example on a one-liner way to clean a string. This one strips out all nonalphanumeric chars except @ - (dash) . (period)
Regular Expression Exampleshere's the one-liner in case the page is gone someday.
Regex.Replace(strIn, @"[^\w\.@-]", "");
here is one that will clean a string to be safe for SQL statement (prevent SQL injection). courtesy of
RegExLib.com ^["a-zA-Z0-9\040]+$
(Matches alphanumeric, space and double quotes)