Follow up to previous question:
Iım trying to validate a multipline asp text box that can have a maximum of
150 word characters but any number of white space, carriage returns or tabs.
I tried several regex that pass testing on regexplib.com but fail on the
page
This for example doesnıt work properly:
ValidationExpression="^\w{1,150}|\s{0,}$"
I get a validation error if any non-word character is added, regardless of
the total length of the string.
I think I'm having a problem because the text box is multiline and the regex
doesn't check it as single line. I have solved that problem before by using
RegexOptions.Singleline in the code behind file but I don't know how to do
that within the asp RegularExpressionValidator tag.
Any idea?
Thanks,
Stephan. 2 9064
Stephan,
You'll need to allow white space characters before, between, and after your
word characters. Try this instead:
^\s*(\w\s*){1,150}\s*$
HTH,
Nicole
"Stephan Bour" <sb***@niaid.nih.gov> wrote in message
news:BBC43274.ADC3%sb***@niaid.nih.gov... Follow up to previous question: Iım trying to validate a multipline asp text box that can have a maximum
of 150 word characters but any number of white space, carriage returns or
tabs. I tried several regex that pass testing on regexplib.com but fail on the page This for example doesnıt work properly:
ValidationExpression="^\w{1,150}|\s{0,}$"
I get a validation error if any non-word character is added, regardless of the total length of the string.
I think I'm having a problem because the text box is multiline and the
regex doesn't check it as single line. I have solved that problem before by
using RegexOptions.Singleline in the code behind file but I don't know how to do that within the asp RegularExpressionValidator tag. Any idea? Thanks, Stephan.
So simple and yet it works so well! Thanks a lot,
Stephan.
in article #v*************@TK2MSFTNGP11.phx.gbl, Nicole Calinoiu at ni*****@somewhere.net wrote on 10/28/03 16:28: Stephan,
You'll need to allow white space characters before, between, and after your word characters. Try this instead:
^\s*(\w\s*){1,150}\s*$
HTH, Nicole
"Stephan Bour" <sb***@niaid.nih.gov> wrote in message news:BBC43274.ADC3%sb***@niaid.nih.gov... Follow up to previous question: Iım trying to validate a multipline asp text box that can have a maximum of 150 word characters but any number of white space, carriage returns or tabs. I tried several regex that pass testing on regexplib.com but fail on the page This for example doesnıt work properly:
ValidationExpression="^\w{1,150}|\s{0,}$"
I get a validation error if any non-word character is added, regardless of the total length of the string.
I think I'm having a problem because the text box is multiline and the regex doesn't check it as single line. I have solved that problem before by using RegexOptions.Singleline in the code behind file but I don't know how to do that within the asp RegularExpressionValidator tag. Any idea? Thanks, Stephan.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Stephan Bour |
last post by:
Follow up to previous question:
Iım trying to validate a multipline asp text box that can have a maximum of
150 word characters but any number of white space, carriage returns or tabs.
I tried...
|
by: RSB |
last post by:
Hi Guys..
its me again.. ;o))
now i have a TextBox with properties Textmode = singleline and MaxLength =
100. So this works fine and i cannot enter more then 100 Chars. But as soon
as i...
|
by: John Hoge |
last post by:
I have a regex "^\d{5}$" that does not allow blanks, but the
RegularExpressionValidator does not fire for empty fields. Is there a
way to make it do so? I would rather not include a separate...
|
by: Nicola Farina |
last post by:
Hi all,
i've a form with a textbox that user "must" fill with a password. I want
to check if there's a password inside, and if it's between 6 an 8 chars.
I've placed a regularexpression...
|
by: Alan Silver |
last post by:
Hello,
I have a custom validator on my page, and have the server-side code
working fine. I want to add a client-side funtion as well, but am not
sure how to wire it in so that it works with the...
|
by: den 2005 |
last post by:
Hi everybody,
How do restrict entering these characters <>\"%';()& and telling user
these caharcters are not allowed to be enter in the textbox field using
RegularExpression Validator? I put in...
|
by: Arpan |
last post by:
Consider the following code which validates a TextBox using
RegularExpression:
<form id="form1" runat="server">
<asp:TextBox id="txt1" runat="server"/>
<asp:RegularExpressionValidator...
|
by: prp |
last post by:
hi all,
I have a problem.Suppose I use a regularexpression validator for zip code. An User fill wrong entry in the relevant textbox then regularexpression validator fires.but user did not...
|
by: dancer |
last post by:
Can somebody tell me why my RequiredFieldValidator works for the TEXT BOX,
(location) but does NOT work for the RADIO BUTTON (EmpTrain)?
<%@ Page Language="VB" ClientTarget="downlevel" %>
...
|
by: hamsterchaos |
last post by:
<asp:RegularExpressionValidator id="valRegEx" runat="server"
ControlToValidate="textbox1"
ValidationExpression=" "
ErrorMessage="* Please only enter alphanumeric values and make sure...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |