
8.09.2005
Clean an Input String - Regular Expression Examples
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 Examples
here's the one-liner in case the page is gone someday.
here is one that will clean a string to be safe for SQL statement (prevent SQL injection). courtesy of RegExLib.com
(Matches alphanumeric, space and double quotes)
Regular Expression Examples
here'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)
Comments:
Post a Comment