Regular Expression to repeat matching in a phrase

I don't think my title for this question is very good.  Hopefully people will notice this question.

If I have a phrase such as this: "You must be enrolled in the School of Business and be a student with junior or senior standing."

I'd like to use regexp to parse out "junior" and "senior".  In this case, they are separated by "or", which can be tossed out.  Here is my regexp so far:

/^You must be enrolled in the School of Business and be a student with\s*((?:junior|senior|(?=\s*or\*))).*\s*standing.$/g

I'm only getting "junior" for this.

If I manipulate it a little bit with this regexp:

/^You must be enrolled in the School of Business and be a student with\s*(((?:junior|senior)|(?=\s*or\*))).*\s*standing.$/g

I get:

Is there a way to get this result:


I will expect that I could possibly have junior or senior or junior and senior phrases and even through in freshman and/or sophomore.  So I'm trying to parse out those tokens.

Another alternative would be to just grab the phrase, e.g.

junior or senior
junior and senior
sophomore or junior or senior
sophomore and junior or senior

So it would be something like ((?:freshman|sophomore|junior|senior|?=(?:and|or))

If I have the whole phrase, I can programatically split the string into tokens instead of having a regex return the individual tokens.  I think either approach will work for me.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

/^You must be enrolled in the School of Business and be a student with\s*(?:(junior)|(senior)|\s*or\s*)*\s*standing.$/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mock5cAuthor Commented:
It only seems to be capturing "senior".  I'm using to test.
> I'm using to test.
That may be your problem.

/^You must be enrolled in the School of Business and be a student with\s*(junior)(?:\s*or\s*)(senior)\s*standing.$/
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.