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.
Here are some common rules you may see:
^CS_135matches one course,CS_135.- Square brackets match any of the characters they contain.
^CS_1[134]5matches any ofCS_115,CS_135, orCS_145but notCS_155.
- A dot matches any character:
^CS_1.5matches a total of ten courses:CS_105,CS_115,CS_125, …,CS_195. It would also match courses likeCS_1u5or evenCS_1@5if we had courses labeled like that! ^CS_135 + ^CS_136matchesCS_135or^CS_136.- An asterisk,
*, matches any number of what immediately precedes it. It often follows a dot, which matches any character.^CS_.*matches any CS course.^ENGL_108.*matchesENG_L108(the.*matches 0 times) as well asENGL_108A,ENGL_108B(useful), andENGL_108ABBBB(not useful).
- A plus,
+is also like*except that it matches one or more (not zero) of what precedes it. This is different from the other useage of the+sign, that one represents a union of sets. - A question mark,
?, matches 0 or 1 occurrences of what precedes it. It’s probably the best way to represent something that is optional. - A “pipe”,
|, is used for “or”. It’s often used with parentheses.^CS_(115|135|145)matches three CS courses.^(CS_|CO_)467matches bothCS_467as well asCO_467.