471,089 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 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 1000
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Neri | last post: by
18 posts views Thread by Q. John Chen | last post: by
14 posts views Thread by Chris | last post: by

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.