Using Regular Expression Validation

Discussion in 'ASP .Net' started by Coleen, Apr 16, 2004.

  1. Coleen

    Coleen Guest

    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.
     
    Coleen, Apr 16, 2004
    #1
    1. Advertising

  2. Coleen

    Peter Blum Guest

    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/manuals/2000/javascript/1.5/reference/regexp.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:
    Creator of "Professional Validation And More" at
    http://www.peterblum.com/vam/home.aspx

    <Coleen> wrote in message news:u7mee5%...
    > 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.
     
    Peter Blum, Apr 17, 2004
    #2
    1. Advertising

  3. Coleen

    Coleen Guest

    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" <> wrote in message
    news:...
    > 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/manuals/2000/javascript/1.5/reference/regexp.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:
    > Creator of "Professional Validation And More" at
    > http://www.peterblum.com/vam/home.aspx
    >
    > <Coleen> wrote in message news:u7mee5%...
    > > 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.
    >
    >
     
    Coleen, Apr 19, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    3
    Views:
    9,968
  2. VSK
    Replies:
    2
    Views:
    2,305
  3. Nazir
    Replies:
    3
    Views:
    5,072
    jayendra gadhavi
    Jan 2, 2008
  4. =?iso-8859-1?B?bW9vcJk=?=

    Matching abitrary expression in a regular expression

    =?iso-8859-1?B?bW9vcJk=?=, Dec 1, 2005, in forum: Java
    Replies:
    8
    Views:
    851
    Alan Moore
    Dec 2, 2005
  5. GIMME
    Replies:
    3
    Views:
    11,973
    vforvikash
    Dec 29, 2008
Loading...

Share This Page