473,379 Members | 1,270 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,379 software developers and data experts.

Regex query

When using the regular expression validator is there a way of failing a
validation when you detect a match - I suppose a sort of anti-match.

I want to detect certain things on user input and if they exist then fail
client-side validation.

An example would be detecting html input, a simple test of which would be to
look for '<[a-zA-z]',
but I would like to fail if this sequence is detected anywhere in a
multiline string.

Is there a way or is it down to server-side validation only?

Shaun

PS. I am still validating the input on the server-side I just wanted to cut
down on round trips
Nov 18 '05 #1
9 2774
Hi Shaun,

Based on my understanding, you want to reverse the process logic of
RegularExpressionValidator control.

To get this done, I think you should use CustomValidator control, which
allows you to write your own code to take part in the validation framework.
Then you can provide your own validate logic on the Form.

For more information about how to use CustomValidator control, please refer
to:
http://msdn.microsoft.com/library/de...us/dnaspp/html
/aspplusvalid.asp

At client side, you may use JScript's RegExp class to do the regular
expression operation. For more information, please refer to the client
Jscript souce code below:
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconscriptfileforsample.asp

In the article, RegularExpressionValidatorEvaluateIsValid method contains
the original RegularExpressionValidator control's logic. FYI.

====================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #2
Hi Shaun,

Based on my understanding, you want to reverse the process logic of
RegularExpressionValidator control.

To get this done, I think you should use CustomValidator control, which
allows you to write your own code to take part in the validation framework.
Then you can provide your own validate logic on the Form.

For more information about how to use CustomValidator control, please refer
to:
http://msdn.microsoft.com/library/de...us/dnaspp/html
/aspplusvalid.asp

At client side, you may use JScript's RegExp class to do the regular
expression operation. For more information, please refer to the client
Jscript souce code below:
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconscriptfileforsample.asp

In the article, RegularExpressionValidatorEvaluateIsValid method contains
the original RegularExpressionValidator control's logic. FYI.

====================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #3
Hi Jeffrey

yup I was thinking along those lines myself as an alternative action - so
what you suggest is that I do a custom validator and then invert the result.
Seems reasonable, I was just hoping there wassome unknown regex expression I
didn't know about.

I'll test it out later and get back to you

shaun

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:Jx**************@cpmsftngxa06.phx.gbl...
Hi Shaun,

Based on my understanding, you want to reverse the process logic of
RegularExpressionValidator control.

To get this done, I think you should use CustomValidator control, which
allows you to write your own code to take part in the validation framework. Then you can provide your own validate logic on the Form.

For more information about how to use CustomValidator control, please refer to:
http://msdn.microsoft.com/library/de...us/dnaspp/html /aspplusvalid.asp

At client side, you may use JScript's RegExp class to do the regular
expression operation. For more information, please refer to the client
Jscript souce code below:
http://msdn.microsoft.com/library/de...us/cpguide/htm l/cpconscriptfileforsample.asp

In the article, RegularExpressionValidatorEvaluateIsValid method contains
the original RegularExpressionValidator control's logic. FYI.

====================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #4
Hi Jeffrey

yup I was thinking along those lines myself as an alternative action - so
what you suggest is that I do a custom validator and then invert the result.
Seems reasonable, I was just hoping there wassome unknown regex expression I
didn't know about.

I'll test it out later and get back to you

shaun

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:Jx**************@cpmsftngxa06.phx.gbl...
Hi Shaun,

Based on my understanding, you want to reverse the process logic of
RegularExpressionValidator control.

To get this done, I think you should use CustomValidator control, which
allows you to write your own code to take part in the validation framework. Then you can provide your own validate logic on the Form.

For more information about how to use CustomValidator control, please refer to:
http://msdn.microsoft.com/library/de...us/dnaspp/html /aspplusvalid.asp

At client side, you may use JScript's RegExp class to do the regular
expression operation. For more information, please refer to the client
Jscript souce code below:
http://msdn.microsoft.com/library/de...us/cpguide/htm l/cpconscriptfileforsample.asp

In the article, RegularExpressionValidatorEvaluateIsValid method contains
the original RegularExpressionValidator control's logic. FYI.

====================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #5
Hi Shaun,

Thanks for your feedback.

Yes, the key point is how to do the do the validation through regular
expression at client.

I will wait for your feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #6
Hi Shaun,

Thanks for your feedback.

Yes, the key point is how to do the do the validation through regular
expression at client.

I will wait for your feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #7
Hi Shaun,

Here's an alternative solution. My product "Professional Validation And
More" (at http://www.peterblum.com/vam/home.aspx) is a replacement to the
built in validators that overcomes their numerous limitations. For example,
all of my 22 validators have a property called NotCondition that when true,
reverses the logic. So you'd plug in my RegexValidator, set the expression
that you want to be false and set NotCondition to true.
This works fully on the client side and my validators support more browsers
for client-side validation than Microsofts. (They support DHTML only; I
support IE, IE/Mac, Netscape/Mozilla, Opera 7, and Safari.)

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Shaun Wilde" <sh*********@nospam.co.uk> wrote in message
news:OH*************@TK2MSFTNGP09.phx.gbl...
When using the regular expression validator is there a way of failing a
validation when you detect a match - I suppose a sort of anti-match.

I want to detect certain things on user input and if they exist then fail
client-side validation.

An example would be detecting html input, a simple test of which would be to look for '<[a-zA-z]',
but I would like to fail if this sequence is detected anywhere in a
multiline string.

Is there a way or is it down to server-side validation only?

Shaun

PS. I am still validating the input on the server-side I just wanted to cut down on round trips

Nov 18 '05 #8
Hi Shaun,

Here's an alternative solution. My product "Professional Validation And
More" (at http://www.peterblum.com/vam/home.aspx) is a replacement to the
built in validators that overcomes their numerous limitations. For example,
all of my 22 validators have a property called NotCondition that when true,
reverses the logic. So you'd plug in my RegexValidator, set the expression
that you want to be false and set NotCondition to true.
This works fully on the client side and my validators support more browsers
for client-side validation than Microsofts. (They support DHTML only; I
support IE, IE/Mac, Netscape/Mozilla, Opera 7, and Safari.)

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Shaun Wilde" <sh*********@nospam.co.uk> wrote in message
news:OH*************@TK2MSFTNGP09.phx.gbl...
When using the regular expression validator is there a way of failing a
validation when you detect a match - I suppose a sort of anti-match.

I want to detect certain things on user input and if they exist then fail
client-side validation.

An example would be detecting html input, a simple test of which would be to look for '<[a-zA-z]',
but I would like to fail if this sequence is detected anywhere in a
multiline string.

Is there a way or is it down to server-side validation only?

Shaun

PS. I am still validating the input on the server-side I just wanted to cut down on round trips

Nov 18 '05 #9
Hi Shaun,

Have you tried it yet? Do you still have any concern?

Please feel free to let me know, I will help you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #10

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

Similar topics

4
by: Fazer | last post by:
Hello, I have a string which has a url (Begins with a http://) somewhere in it. I want to detect such a url and just spit out the url. Since I am very poor in regex, can someone show me how to...
3
by: a | last post by:
I'm a newbie needing to use some Regular Expressions in PHP. Can I safely use the results of my tests using 'The Regex Coach' (http://www.weitz.de/regex-coach/index.html) Are the Regular...
3
by: jwgoerlich | last post by:
Hello group, I am working on a query string class. The purpose is to parse name-value pairs from incoming text. Currently, I am using the Regex code below. I have two questions. First, the...
0
by: =?ISO-8859-15?Q?C=E9dric?= | last post by:
Hi all, I want to import a SQL script (SQLite) executing each queries separately. - I read the SQL file - I split the read string with the separator ";" - I execute each query string query...
15
by: nagar | last post by:
I need to split a string whenever a separator string is present (lets sey #Key(val) where val is a variable) and rejoin it in the proper order after doing some processing. Is there a way to use...
0
by: rmccullough | last post by:
The test tool I use produces xml files that I am parsing and inserting into a mysql database. I then have a set of php pages that report on the test results. I wrote a C# console application that...
0
by: Guoqi Zheng | last post by:
Dear Sir, I need to use regex to replace some string. Below is what I use. output = "sample data <href=""xlink:GG44-33"">, part two <href=""xlink:GG55-123"">" Dim regEx Set regEx = New...
0
by: vmysore | last post by:
I am trying to get all the columns selected within a SQL query (including the sub selects). When the code hits matcher.find(). i get the following exception: Exception in thread "main"...
4
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
Prior to now, my RegEx expression was as follows: RegEx pattern = new Regex(@"\d{5} \d{4} \d{2}"); That has worked, but now I have been asked to enable the ability for our expressions to...
2
by: Smokey Grindel | last post by:
I basically need to remove any leading zeros and hyphens from a string... regex seemed like the best rout and using a replace regex method... anyone know of any good strings for this? The one I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.