Wrox Programmer Forums
|
BOOK: Beginning ASP.NET Databases Also see the forum ASP Databases for more general discussions of ASP database issues not directly related to these books.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Databases 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
 
Old November 5th, 2008, 03:32 PM
alienaheart
Guest
 
Posts: n/a
Default expression Validator

I am using a regular exp validator to accept alphabets:

ValidationExpression="[A-Za-z]*"
But , I also want accept these special characters along with
the alphabets: ( ,), {,} ,[,].
How should I modify the above expression????

Alienaheart
 
Old November 5th, 2008, 04:36 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Code:
    ValidationExpression="[A-Za-z\(\)\{\}\[\]]*"
Just put a backslash in front of any special character.

But I hope you realize that this expression will make the following inputs *LEGAL AND ACCEPTED*:

--------x--------
a$$$$$$$$$$$$
[**************
19111731111(8817721
%%%%%%%%X%%%%%%%%

And many more.

If you mean that you want *ONLY* the characters you have listed, then you *MUST* add the beginning-of-text and end-of-text markers, thus:
Code:
    ValidationExpression="^[A-Za-z\(\)\{\}\[\]]*$"





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
Regular Expression Validator displaying a label thomaswharmanjr26 C# 0 January 25th, 2008 03:38 PM
Validator expression Maxxim ASP.NET 1.0 and 1.1 Professional 1 December 3rd, 2006 07:07 AM
Regular expression validator PT C# 4 August 25th, 2005 07:50 AM
question regarding regular expression validator NewbieProg Classic ASP Basics 1 November 9th, 2004 08:49 AM





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