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
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.