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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top