Course Sets

Plan specifications deal with sets of courses. We need a compact but flexible way to specify them.

We start with regular expressions to specify one or many courses. We then add restrictions such as requiring that the courses in the set be passed. Finally, we can combine sets of courses.

Course sets can be named to help with readability.

There are a number of default named sets that are almost always included.

Regular Expressions

Regular expression syntax is often used to describe sets of courses. This section is just a small part of what is used in the plan definitions and if you wish to learn more, check out For Plan Writers.

In Degree Audit, every regular expression starts with a circumflex, ^, that marks the beginning. The subject part of a course is separated from the catalog number part with an underscore, _.

Here are some common rules you may see:

Sample Regular Expression Sample Matches Explanation
^CS_135 CS_135 Matches one specific course. Most characters in the RE “match” themselves. The ^ is special to start the RE. Then the C, S, 1, 3 and 5 in the RE match the corresponding character in the course. The same goes for the _.
^CS_1.5 CS_105, CS_115, …, CS_195 Dot matches any single character. If we had courses named CS_1a5 or CS_1A5 or even CS_1@5, those would match too.
^CS_1[134]5 CS_115, CS_135, CS_145 Square brackets match any single character they contain
^ENGL_108[A-G] ENGL_108A, ENGL_108B, … ENGL_108G Square brackets may have a dash to indicate a range of matching letters.
^CS_.* CS_, CS_1, CS_11, CS_111, CS_1111 and many others Asterisk matches zero or more of the preceding character (recall that dot matches any character). This would also match CS_1XX (a transfer course).
^CS_[123]+ CS_1, CS_1132 and many others. A plus sign matches one or more of the preceding pattern. In this case, the preceding pattern is [123].
CS_135[A-Z]? CS_135, CS_135A, CS_135B, … CS_135Z A question mark matches the pattern zero or one times. That is, the preceding pattern is optional.
^CS_(115|135|145) CS_115, CS_135, CS_145 Pipe symbol (|) acts as OR operator between options. It is usually used in conjunction with parentheses.
^(CS|CO)_467 CS_467, CO_467 Another example for pipe.

Naming Course Sets

Course sets can be named:

commList1 = ^(SPCOM|COMMST)_100 + ^(SPCOM|COMMST)_223 + ^EMLS_101R + 
            ^EMLS_102R + ^(EMLS_|ENGL_)129R + ^ENGL_109
commList2 = commList1 + ^(SPCOM|COMMST)_225 + ^(SPCOM|COMMST)_227 + 
            ^(SPCOM|COMMST)_228 + ^EMLS_103R + ^EMLS_104R + ^EMLS_110R + 
            ^ENGL_101B + ^ENGL_108B + ^ENGL_108D + ^ENGL_119 + 
            ^ENGL_208B + ^ENGL_209 + ^ENGL_210E + ^ENGL_210F + 
            ^(ENGL_378|MTHEL_300)

A requirement can then use these named sets:

all of {
    1.0 units from commList1
    0.5 units from commList2
}

Restrictions

Restrictions are added using a “where clause”. For example,

1 of {
    ^CS_456 where takenAfter(1205), takenBefore(1259)
    ^CS_457
}

is satisfied by CS_457 or CS_456, provided CS456 was taken after Spring 2020 and before Fall 2025.

Other restrictions include:

  • attemptClass: Classifies courses. Common ones include PASS, FAIL, and COOP.
  • earnedCredit: Only courses where the student earned credit.
  • transferCredit: Accept only transfer credits.
  • courseGrade: Specify grades above 70%, for example.
  • usableCourseAttempt: Implements a Math faculty rule
  • courseComponent: Specify labs, seminars, etc.

See the plan writer’s documentation for more details.

Combining Course Sets

Course sets can be combined in three ways: union, difference, and intersection.

Union

Union is represented with + and can be thought of as “or”.

3 from ^CS_4.. + ^MATH_4..

looks for three courses from 4th year CS and MATH courses. It could be a mix of CS and MATH courses.

Difference

Set difference is represented with - and can be read as “courses from X except for courses from Y”.
For example,

3 from ^CS_4.. - (^CS_491 + ^CS_492)

requires three 4th year CS courses except for CS_491 and CS_492, which are not allowed.

This example also shows that parentheses can be used for grouping.

Intersection

Intersection is represented with /\. It represents all those courses that are in both sets.
For example,

maxUnits(2.0, ^CS_4.. /\ failedCourses)

Looks at 4th year CS courses that are also failed (courses in both sets). It requires that there be no more than 2.0 units of such courses.

Default Named Course Sets

The following sets are usually defined by default.

allCourses            = ^([A-Z]+)_(([0-9]+X*|XXX|1X000)[A-Z]{0,2})$

coop                  = allCourses where attemptClass(Coop)
inProgressCoopCourses = coop /\ ^COOP_.* where inProgress(true)
coopCourses           = coop /\ ^COOP_.* where courseGrade("CR") + inProgressCoopCourses
inProgressPDCourses   = coop /\ ^PD_.* where inProgress(true)
pdCourses             = coop /\ ^PD.* where courseGrade("CR") + inProgressPDCourses
inProgressWorkReports = coop /\ ^WKRPT_.* where inProgress(true)
workReports           = coop /\ 
                        ^WKRPT_.* where courseGrade("^([56789][0-9]|100|[ABCD]|CR)$") + 
                        inProgressWorkReports
inProgressCourses     = (allCourses - coop) where inProgress(true)
passedCourses         = (allCourses - coop) where attemptClass(Pass) + inProgressCourses
failedCourses         = (allCourses - coop) where attemptClass(Fail)