473,394 Members | 2,052 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,394 software developers and data experts.

Need help with regular expression.

Hi,
I'm stuck with this regular expression from past 2 days. Desperately
need help.

I need a regular expression that will allow all characters except these
*:~<>'

This is my code in VB.Net-
Dim regex As System.Text.RegularExpressions.Regex
regex = New System.Text.RegularExpressions.Regex("^[^*:~<>']*$")
It matches for most of the test cases except when I enter <mno or mn<vb

it throws an exception- "A potentially dangerous Request.Form value was
detected from the client (txtregex="<vb"). "

How I get around this? Please help.

Thanks a lot.

Nov 21 '05 #1
1 1087
Hi,

This should work for you. If the string contains the charcters ismatch
will return true
Dim rMatch As New System.Text.RegularExpressions.Regex("[*:~<>']")
TextBox1.Text = (rMatch.IsMatch("<mno")) & vbCrLf
TextBox1.Text &= (rMatch.IsMatch("x is less than y")) & vbCrLf
TextBox1.Text &= (rMatch.IsMatch("mn<vb"))
Ken
----------------------
"hillcountry74" <sh*******@yahoo.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,
I'm stuck with this regular expression from past 2 days. Desperately
need help.

I need a regular expression that will allow all characters except these
*:~<>'

This is my code in VB.Net-
Dim regex As System.Text.RegularExpressions.Regex
regex = New System.Text.RegularExpressions.Regex("^[^*:~<>']*$")
It matches for most of the test cases except when I enter <mno or mn<vb

it throws an exception- "A potentially dangerous Request.Form value was
detected from the client (txtregex="<vb"). "

How I get around this? Please help.

Thanks a lot.

Nov 21 '05 #2

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

Similar topics

4
by: Neri | last post by:
Some document processing program I write has to deal with documents that have headers and footers that are unnecessary for the main processing part. Therefore, I'm using a regular expression to go...
3
by: Joe | last post by:
Hi, I have been using a regular expression that I don’t uite understand to filter the valid email address. My regular expression is as follows: <asp:RegularExpressionValidator...
18
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
6
by: deepak_kamath_n | last post by:
Hello, I am relatively new to the world of regex and require some help in forming a regular expression to achieve the following: I have an input stream similar to: Slot: slot1 Description:...
14
by: Chris | last post by:
I need a pattern that matches a string that has the same number of '(' as ')': findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) = Can anybody help me out? Thanks for any help!
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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...
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
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.