Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 5th, 2005, 01:53 PM
Authorized User
Join Date: Jan 2005
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Regular Expression for Multiline TextBox

I have defined a Textbox with Multiline property.
This text box is suppose to accept any character
including white space such as carriage return, newline etc.
Also, the total no. of characters should not exceed 120.

I have tried .{1,120} - It works in the sense that it accepts any
character except carriage return.

What is the correct Regular Expression, I can define for Regular Expression Validator for this?

  #2 (permalink)  
Old January 6th, 2005, 01:22 AM
Friend of Wrox
Join Date: Dec 2004
Location: Chennai, Tamil nadu, India.
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel

Thats right ... period "." would accept all characters except new line character "\n"

Best Regards

  #3 (permalink)  
Old January 6th, 2005, 01:29 AM
Friend of Wrox
Join Date: Oct 2003
Location: Chennai, TamilNadu, India.
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi

. matches the charaters expect '\n'
Use [\s\S]{1,120} to accept newline characters also...

  #4 (permalink)  
Old January 6th, 2005, 02:22 AM
Authorized User
Join Date: Jan 2005
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks Santhi,

The Regular Expression [\s\S]{1,120} works perfectly for Multiline textbox. It accepts carriage returns and also limits the size to 120 characters.


Dilip Nagle

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expression Validator on Multi-Line TextBox wagswvu General .NET 1 June 4th, 2008 09:24 AM
AcceptsReturn multiline textbox suzila General .NET 19 March 10th, 2006 02:28 AM
Storing Multiline Textbox value. rupen Classic ASP Basics 7 July 20th, 2005 02:21 PM
How to make an uneditable multiline textbox ltdanp21 VS.NET 2002/2003 2 June 16th, 2004 06:19 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.