← All challenges

Rules with Regular Expressions

July 2025

business-rules

A university is building a system to help students choose courses toward a degree. Each course has a unique code such as “MA523” or “CS38251”. Create a decision service that splits a set of courses into “allowed” and “not allowed” lists using pattern-based rules like these:

  1. If the Degree Code is “MA Single” and the Course Code matches the pattern MA52# or MA62# (where # is any single character), add the course to the allowed list.
  2. If the Degree Code is not “CS%” and the Course Code matches the pattern CS%288% or CS%289% (where % is any run of characters), add the course to the not-allowed list.

Send your solutions to DecisionManagementCommunity@gmail.com, or open a pull request to add yours here.

Solutions