CodersBarn.com
The ASP.NET Community Blog

Visual Studio 2008 Regular Expression Editor

October 27, 2008 20:36 by agrace

If anything can drive this Irishman into a fit of cursing, it's the need to create a regular expression quickly. With a little application, I know I could learn to create them myself but I figured some time back that the frequency with which I use them would not equate to the time invested in the study. So, I either have to rely on ones that I have, and can never locate, or turn to a good tool.

Well, I was reading Professional ASP.NET 3.5 in C# and VB by Scott Hansleman and others recently when I saw mention of a Regular Expression Editor in VS 2008. This was news to me! Then I noticed a regular expression facility in the Find and Replace tool (CTRL-F); how long has that one been around? Anyway, it was just what I needed for some basic regex's for email and phone numbers.

VS 2008 Regular Expression Editor

 

The only problem is trying to find the thing... they couldn't have hid it better if they tried. First, you have to be in design view to begin to locate it. Do people actually use design view? Then you have to refer to the control's properties window and click on the button next to the ValidationExpression property to launch the editor. Obvious, huh? :-|

VS 2008 Regular Expression Editor

 

Granted, it's pretty basic but if you're in a hurry this will save you some Googling time! I wonder is it possible to extend this tool to add in one's own custom regex's for reuse?

One more thing: Scott's book is a great reference with over 1600 pages of info. I have only two gripes about it: 1) If you read it in bed you'll need a hoist to avoid the hernia, and 2) The entire book is based on the Web Site template. What were they thinking of?

kick it on DotNetKicks.com   PHP, ASP, .NET, JSP Resources, Reviews


Comments

November 3. 2008 08:05

trackback

Trackback from DotNetKicks.com

Visual Studio 2008 Regular Expression Editor

DotNetKicks.com

November 4. 2008 23:18

Amgad Suliman

Hey Anthony, I dont use regular expressions much too, so I rely on http://regexlib.com/ for the job, check it out it has all the standard stuff you might need. And by the way this is not my site I just thought you might find it useful.

Amgad Suliman

November 4. 2008 23:55

agrace

Thanks for the link Amgad Smile

agrace

November 5. 2008 17:30

Adam Żochowski

For the love of god, do not validate emails using regexp!

The provided example will pass many invalid email, while fail many valid emails.

Emails are not simple to parse. Read RFC 2822. Or best yet, checkout one of the most standard compliant email parsers. Perl's Email::Valid module :

h__p://search.cpan.org/src/MAURICE/Email-Valid-0.15/Valid.pm

Kind regards

Adam Żochowski

November 5. 2008 17:50

agrace

Hi Adam,

The main thrust of the post is about the tool itself and its use for "general purposes". That said, you make a very valid point and I feel guilty for promoting a lazy approach to data input validation. I think I'll come back to this in another post and outline a better practice!!

Thanks for pointing that out Adam,
Anthony Smile

agrace

September 12. 2009 04:40

trackback

Trackback from WebDevVote.com

Visual Studio 2008 Regular Expression Editor

WebDevVote.com

September 30. 2009 15:28

building hardware

Thanks for sharing!

building hardware

July 31. 2010 06:21

friendship forever

The purpose of your website can be great for my students. A lot of great resources are free in here. Initially, I have introduced your website to my students in my class, so don’t be confused if your website hits are increase dramatically. I discuss many topics, still debating in every aspect that can be debated, and at the end of my class (every week), I told them about the conclusion of your topic. Hot topic and atmosphere can be fun here. And then, you might be surprised that my students got new story every day, and also all of them can express their idea in home and school. Especially they told to her/his mom/dad, that they learnt many topics from teacher that learnt from you. Surprisingly that everyone wants to get new challenge in your idea, and then when I give new topic, it can be challenging for all of my students.

friendship forever

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading