How to negate repeating patterns from regular expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to figure out the expression to validate user input that allows all characters, but not - - (double dash, which is SQL Server T-SQL comment) to prevent SQL Injection

Thanks in advanc
 
I'm trying to figure out the expression to validate user input
that allows all characters, but not - - (double dash, which is
SQL Server T-SQL comment) to prevent SQL Injection.

Are you using a RegularExpressionValidator control in an ASP.NET
page? If so, it may be easier to use a CustomValidator
control instead, using logic like this:

arguments.IsValid = (inputText.IndexOf("--") == -1);

Hope this helps.

Chris.
 
Back
Top