473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to negate repeating patterns from regular expression

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

Jul 21 '05 #1
2 1868
"=?Utf-8?B?Y2hpdmVyeQ==?=" <ch********@yahoo.com> wrote in
news:4E**********************************@microsof t.com:
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.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Jul 21 '05 #2
"=?Utf-8?B?Y2hpdmVyeQ==?=" <ch********@yahoo.com> wrote in
news:4E**********************************@microsof t.com:
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.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: James Collier | last post by:
Is it possible to capture the results of repeating group matches in the python regular expression module? To illustrate, what I want is: >>> re1 = re.compile("(W)(X)+(Y)"); >>> mo1 =...
1
by: Neil Morris | last post by:
Hi I have the following code that lists first names of people who's surnames are 'Morris'. What I am trying to do is search for first names that don't start at the beginning of the line ie. have...
4
by: farseer | last post by:
i'm looking for the right solution to my problem. i have an app that uses certain core set of data object that it knows about and operates on. The source of the actually data however may come...
2
by: chivery | last post by:
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
1
by: shilpi.rustagi | last post by:
hi again.. i have a basic regular expression problem. we can negate a single charecter like this . but i want to negate a whole group e.g (<\tag>) hw can i do that can anyone help on it. ...
2
by: cball43 | last post by:
Hi, I'm new to Perl and am having difficulty in getting this regular expression to work as I need it to. The expression needs to match a substring that has a phrase containing "Waldo" repeated...
3
by: bagelman | last post by:
Hi, I want to find repeating words in a long string with Regular Expressions. I tried to write a regular expression but it didn't work. "\b(?<word>\w+)\s+(\k<word>)\b" This RegEx finds...
8
by: Summercool | last post by:
somebody who is a regular expression guru... how do you negate a word and grep for all words that is tire but not snow tire or
2
by: ogo796 | last post by:
hi everyone can anyone help me with the php pattern that search the following string and get the below patterns. "2004_8.rtf" (November) S v Mimi(000/00) NAME 8; "2005_9.rtf" (November) S v...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.