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?
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: