By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,299 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,299 IT Pros & Developers. It's quick & easy.

Using Regular Expression Validation

P: n/a
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
Share this Question
Share on Google+
2 Replies

P: n/a
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

P: n/a
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.