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

RegularExpressionValidator help

I'm hoping this is simple. All I want to do is to make sure that a /
(slash) is not entered into a text box. here are some of my failed
attempts:

ValidationExpression="\w[^\/]"
ValidationExpression="\w[^/]"
ValidationExpression="^/"
ValidationExpression="[^/]"
ValidationExpression="w[^/]"

... and many more variations. please help!
Nov 18 '05 #1
5 1260
Mark Dengler wrote:
.. and many more variations. please help!


if (!Regex.IsMatch("Is this string / valid?", "/"))
{
// You have a valid string, process it.
}

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 18 '05 #2
Hi Mark,

You would have to make sure to include everything except the slash ... eg
....

ValidationExpression = "^[\w\s\d]*$"

.... add other things between the [] that you want to match. otherwise, go
with Frank's !Match solution

Alex Papadimoulis
"Mark Dengler" <md******@go.com> wrote in message
news:8c**************************@posting.google.c om...
I'm hoping this is simple. All I want to do is to make sure that a /
(slash) is not entered into a text box. here are some of my failed
attempts:

ValidationExpression="\w[^\/]"
ValidationExpression="\w[^/]"
ValidationExpression="^/"
ValidationExpression="[^/]"
ValidationExpression="w[^/]"

.. and many more variations. please help!

Nov 18 '05 #3
Frank,

I'm leaning towards your solution because I'm able to specify the single
item that is not valid as opposed to everything that is. Does this
solution apply to server processing only or may I implement this on the
client?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
You could use this one:

[^/]*

The "[^/]" syntax means "any character except for /". The "*" just means
"zero or more". You had the right idea in your fourth expression, but it
would only match if there were just a single character input. Adding the
"*" allows any size input (including zero-length) as long as there is no
slash.
Brian Davis
www.knowdotnet.com

"Mark Dengler" <md******@go.com> wrote in message
news:8c**************************@posting.google.c om...
I'm hoping this is simple. All I want to do is to make sure that a /
(slash) is not entered into a text box. here are some of my failed
attempts:

ValidationExpression="\w[^\/]"
ValidationExpression="\w[^/]"
ValidationExpression="^/"
ValidationExpression="[^/]"
ValidationExpression="w[^/]"

.. and many more variations. please help!

Nov 18 '05 #5

Brian... that's what I'm talkin about! Thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #6

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

Similar topics

0
by: Andy Eshtry | last post by:
I have a radio button list, a textbox representing SIN or EIN based on my radio button list selection so I put 2 regularexpressionvalidator to evaluate the value of textbox. EIN must be (for...
1
by: MS Newsgroups | last post by:
Hi, I am new to Asp and need some help to write an expression to use with a regularexpressionvalidator. I need to validate that the field meets these requirements: minimum of 8 characters...
3
by: Ricardo Corsi P. Cesar | last post by:
Hi, i looking for example in asp.net (VB) to make the RegularExpressionValidator in runtime in my code behind. I found some similars codes, but nothing in VB.. thanks!
0
by: venkat Murthy | last post by:
Hi, I have 10 regularexpression validators in my datagrid. my datagrid looks like; first5controls | boundcolumn | next5controls. Regularexpressionvalidator for first five controls works...
1
by: franz | last post by:
does anybody tell me why it doesn't works?? in any case gg beame true thanks franz Dim y As RegularExpressionValidator = New RegularExpressionValidator y.ValidationExpression =...
1
by: John Yopp | last post by:
I'm trying to use a asp:RegularExpressionValidator to validate the strength of a password. When I test the regular expression with Regex.IsMatch, it works perfectly. However, when used within a...
4
by: simonZ | last post by:
I have RegularExpressionValidator which validate one text box. When my text box is validated on client I would like to do something else. Is there some client event of RegularExpressionValidator?...
4
by: =?Utf-8?B?Y3VyaW91cw==?= | last post by:
I am using a RegularExpressionValidator to validate a TextBox. I use "^?+(\.*)?$" to check for a real number. The control works fine as long as the user enters something in the TextBox; it does not...
0
by: alastair.slater | last post by:
Hi all, Can anyone help please? I'm using the following code to validate a password entered by new users in an <asp:Textbox ... />: <asp:RegularExpressionValidator ID="RegularPassword"...
9
by: Nathan Sokalski | last post by:
I have several TextBoxes with TextMode="MultiLine" in which I want to limit the number of characters that can be entered using a RegularExpressionValidator. I have come up with the following...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.