Nishanth's Blog | Regular expression Validator against multiline textbox carriage return issue

Regular expression Validator against multiline textbox carriage return issue

by Nishanth 5. March 2009 02:32

I was 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 and special characters. I tried several regex but all were failing when there was a carriage return(Newline / Enterkey ) on the multiline textbox.

Then I found this expression which validated the newlines in the multiline textbox:

"[\s\S]{0,150}" .

 

The basics!!  Try this out , this works!!

Tags:

Comments

5/13/2009 9:42:11 AM #

It doesn work, try this write couple of charaters then press enter again write couple of character press enter twice or thrice and it fails, my limit is 500

sam United States

5/18/2009 7:56:01 AM #

I have tried this just now and it works fine for 500 too. you can try any number of characters. I have mailed you the source code too.

nishanthnair India

7/29/2010 9:38:35 AM #

Hello Nishanth, I liked your article, how to subscribe to RSS?

Apotheke United States

8/11/2010 12:48:26 AM #

Hey I write articles at being a cnut check it

free games United States

Add comment




  Country flag

Click to change captcha
biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.6.0.0
Theme by Mads Kristensen


About Me

Nishanth Nair  

 A die hard fan of Rise of Nations... I write few softwares for McAfee Inc. for a living.

 

Portfolio:

http://morningbellnews.com
http://Necab.org
http://SufiKatha.com
http://DeepaRecipes.com
http://ManipalFoundation.in
http://NetraArts.com
http‌://EnWebTech.com
Contact : Nair.Nishanth@Gmail.com 

 

All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer.

Tag cloud

free counters