Regular Expression - Help

Joined
Jul 4, 2007
Messages
3
Reaction score
0
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:

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top