Regular Expression - Help

Discussion in '.NET' started by Indo77, May 27, 2008.

  1. Indo77

    Indo77

    Joined:
    Jul 4, 2007
    Messages:
    3
    Hi,

    I am using the asp:RegularExpressionValidator to create regular expressions. I am building a form in which a student enters the name of an author (or authors) that will then generate a bibliography for them. I have no issues with the following fields

    Hogg,G = [a-zA-Z]*[,][a-zA-Z]*

    Hogg,G & Hogg,C = [a-zA-Z]*[,][a-zA-Z]*\s[&]\s[a-zA-Z]*[,][a-zA-Z]*

    However this is where I run into problems. I have no guarantee how many authors there will be. For example, Hogg,A, Hogg,B, Hogg,C, Hogg,D & Hogg,E

    or it could be

    Hogg,A, Hogg,B, Hogg,C & Hogg,D

    I know that the * and + is what is used for repeat expressions. I have tried various expressions but nothing will work. I am working with this expression - notice the brackets for grouping.

    ([a-zA-Z]*[,][a-zA-Z]*[,]\s[a-zA-Z]*[,][a-zA-Z]*[,])*\s[&]\s[a-zA-Z]*[,][a-zA-Z]

    Hogg,A, Hogg,B, Hogg,C, & Hogg,D won't work with it

    but

    Hogg,A, Hogg,B, & Hogg,D will work

    I don't get it, what am I doing wrong?
    Last edited: May 27, 2008
    Indo77, May 27, 2008
    #1
    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. Anand

    Regular Expression help...

    Anand, Jul 9, 2003, in forum: Perl
    Replies:
    1
    Views:
    1,221
    Eric J. Roode
    Jul 9, 2003
  2. Eric B.
    Replies:
    1
    Views:
    428
    Jim Gibson
    Dec 17, 2004
  3. VSK
    Replies:
    2
    Views:
    2,272
  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:
    831
    Alan Moore
    Dec 2, 2005
  5. GIMME
    Replies:
    3
    Views:
    11,923
    vforvikash
    Dec 29, 2008
Loading...

Share This Page