简单的正则表达式问题(C#,SQL Server)

vts*_*123 0 c# regex sql-server sql-injection winforms

我有一些正则表达式,它看起来像这样:

string regexForDrop = @"^((%27)|'|(\-\-))\s*(d|%64|%44)(r|%72|%52)(o|%6F|%4F)(p|%70|%50)$";
Run Code Online (Sandbox Code Playgroud)

它工作正常,当我写入输入" - drop",但它不起作用,当我写"drop table users"或类似的东西.无论" - drop"之后出现什么,我都需要它能够工作.我该如何实现呢?

谢谢

Mic*_*rry 6

看来你试图阻止sql注入攻击.对于此使用参数化查询,您不需要检查注入.

好阅读:http:
//weblogs.asp.net/scottgu/archive/2006/09/30/Tip_2F00_Trick_3A00_-Guard-Against-SQL-Injection-Attacks.aspx