in reply to complex regex

This smells like Homework, but since you are asking for guidance - here is some.

You need to analyze the problem, and come up with a data structure that will allow you to verify no duplicates.

To simplify the data structure, you could flatten out Courses and grades , and map it to something like this:

[Math A+] [Math A] [Math B+] ..... [Math F-] Stu1 Stu2 .... Stu3 [Gov A+] ...... ..[Gov F-] Stu5 Stu3 ....
This maps to one Single-dimensional Array per subject. Of course, there are many ways to do this. Hope this helps.

"Experience is a wonderful thing. It enables you to recognize a mistake when you make it again."