469,641 Members | 1,171 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,641 developers. It's quick & easy.

Using Regular Expression Validation

I can't remember the correct way to write a custom regular expression validator, and the help file for VB.net is not terribly helpful...it does not give any real world examples. I've got the main syntax of ^[a-zA-z] but I can't remember how to write the next portion. I need to validate passwords...they must start with a letter of the alphabet, can contain 0-9 and can contain the special characters @#$%&, I just can't remember the correct syntax to write this as a regular expression validation.
Is it ^[a-zA-z]|[a-zA-Z0-9@#$%&] ? I'm not certain about the special characters, they can be in any order as long as the first character is a letter.

Any help/suggestions are greatly appreciated.

TIA, Coleen

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
Nov 18 '05 #1
2 2011
That looks very good for someone who cannot remember Regexes :)

Here's a resource I like for figuring out regexes:
http://devedge.netscape.com/library/...p.html#1193136

The only question I would have is whether you have a minimum size. In that
case, replace the ? with a {min, max} like {4, 20}.

Also add the '$' to the end.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

<Coleen> wrote in message news:u7****************@TK2MSFTNGP11.phx.gbl...
I can't remember the correct way to write a custom regular expression validator, and the help file for VB.net is not terribly helpful...it does
not give any real world examples. I've got the main syntax of ^[a-zA-z] but
I can't remember how to write the next portion. I need to validate
passwords...they must start with a letter of the alphabet, can contain 0-9
and can contain the special characters @#$%&, I just can't remember the
correct syntax to write this as a regular expression validation. Is it ^[a-zA-z]|[a-zA-Z0-9@#$%&] ? I'm not certain about the special characters, they can be in any order as long as the first character is a
letter.
Any help/suggestions are greatly appreciated.

TIA, Coleen

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup

engine supports Post Alerts, Ratings, and Searching.
Nov 18 '05 #2
Thanks :-) I took it in class, but it's been months since I've used it, so
I'm not certain it will do everything I need. I do need to check it for
length, thanks very much for the suggestion and link. I appreciate it :-)
"Peter Blum" <PL****@Blum.info> wrote in message
news:eB**************@TK2MSFTNGP11.phx.gbl...
That looks very good for someone who cannot remember Regexes :)

Here's a resource I like for figuring out regexes:
http://devedge.netscape.com/library/...p.html#1193136
The only question I would have is whether you have a minimum size. In that
case, replace the ? with a {min, max} like {4, 20}.

Also add the '$' to the end.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

<Coleen> wrote in message news:u7****************@TK2MSFTNGP11.phx.gbl...
I can't remember the correct way to write a custom regular expression validator, and the help file for VB.net is not terribly helpful...it does
not give any real world examples. I've got the main syntax of ^[a-zA-z]

but I can't remember how to write the next portion. I need to validate
passwords...they must start with a letter of the alphabet, can contain 0-9
and can contain the special characters @#$%&, I just can't remember the
correct syntax to write this as a regular expression validation.
Is it ^[a-zA-z]|[a-zA-Z0-9@#$%&] ? I'm not certain about the special

characters, they can be in any order as long as the first character is a
letter.

Any help/suggestions are greatly appreciated.

TIA, Coleen

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup

engine supports Post Alerts, Ratings, and Searching.

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Coleen | last post: by
5 posts views Thread by tmeister | last post: by
3 posts views Thread by Robert Scheer | last post: by
18 posts views Thread by Q. John Chen | last post: by
4 posts views Thread by Brian Simmons | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.