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

Simple Validation Problem Using Regex

I'm using VS2005 programming in VB.Net.

I have a simple aspx page. In the Insert mode, I have a textbox with a
simple RegularExpressionValidator set to not accept more than 1000
characters. I'm using the expression ".{1,1000}" w/o the quotes and I
thought this would work. The DB table for this Column is set to
varchar(1000).

This works fine as long as I keep typing and it's under 1000 characters, but
as soon as I hit the RETURN key and start typing again, the validator thinks
I'm over 1000 characters. This happens even if I just type 4 characters and
then hit Return.

I've checked http://regexlib.com, but couldn't find the answer.

Can someone tell me what I'm doing wrong. I have to be able to let my users
enter the RETURN key.

Thanks in advance.
Phil
Oct 4 '06 #1
2 1484
(?s).{1,1000}

The dot character class by default does not include newlines. When you hit
the ENTER key, the match is negated due to the insertion of a newline. The
"(?s)" directive in the regular expression indicates that it should include
newlines.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

If the Truth hurts, wear it.

"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:OL**************@TK2MSFTNGP03.phx.gbl...
I'm using VS2005 programming in VB.Net.

I have a simple aspx page. In the Insert mode, I have a textbox with a
simple RegularExpressionValidator set to not accept more than 1000
characters. I'm using the expression ".{1,1000}" w/o the quotes and I
thought this would work. The DB table for this Column is set to
varchar(1000).

This works fine as long as I keep typing and it's under 1000 characters,
but as soon as I hit the RETURN key and start typing again, the validator
thinks I'm over 1000 characters. This happens even if I just type 4
characters and then hit Return.

I've checked http://regexlib.com, but couldn't find the answer.

Can someone tell me what I'm doing wrong. I have to be able to let my
users enter the RETURN key.

Thanks in advance.
Phil

Oct 4 '06 #2
Thanks Kevin!!!
"Kevin Spencer" <uc*@ftc.govwrote in message
news:u9**************@TK2MSFTNGP02.phx.gbl...
(?s).{1,1000}

The dot character class by default does not include newlines. When you hit
the ENTER key, the match is negated due to the insertion of a newline. The
"(?s)" directive in the regular expression indicates that it should
include newlines.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

If the Truth hurts, wear it.

"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:OL**************@TK2MSFTNGP03.phx.gbl...
>I'm using VS2005 programming in VB.Net.

I have a simple aspx page. In the Insert mode, I have a textbox with a
simple RegularExpressionValidator set to not accept more than 1000
characters. I'm using the expression ".{1,1000}" w/o the quotes and I
thought this would work. The DB table for this Column is set to
varchar(1000).

This works fine as long as I keep typing and it's under 1000 characters,
but as soon as I hit the RETURN key and start typing again, the validator
thinks I'm over 1000 characters. This happens even if I just type 4
characters and then hit Return.

I've checked http://regexlib.com, but couldn't find the answer.

Can someone tell me what I'm doing wrong. I have to be able to let my
users enter the RETURN key.

Thanks in advance.
Phil


Oct 4 '06 #3

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

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
6
by: Hernán Castelo | last post by:
should i to validate all the "Request"s calls like Request.FORM("...") and Request.Cookies("...") ???? if it is so, i have to see inside every "Input" elements like "Text" and even "Hidden"...
4
by: VbUser25 | last post by:
Hi Please suggest i think i am doing something wrong. I am calling fucntion test from another function where i am performing all the validations.I want to validate the email id. this is the...
2
by: live your lives | last post by:
i am trying to validate a simple username textbox using RegularExpressionValidator: TextBox tbUserName = new TextBox(); tbUserName.ID = "tbUserName"; string strPatternUserName = @"\W"; //...
1
by: Stephen Adam | last post by:
Hi there, I have written a custom validation control which checks to see of an input field is not empty and contains only numeric data. I was using a regular expression validation control but...
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...
1
by: Jim Dornbush | last post by:
Has anyone seen an updated regex expression from Microsoft for the email validation expression so that single quotes are allowed? I've been using the canned regex for emails, but recently been...
11
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether...
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
2
by: Alpha83 | last post by:
Hi, Is it safe or error-free to validate country zip-codes using regular expressions - especially for countries like UK or Canada, where there are different alphanumeric formats. Here's what I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.