From a81653c6feeaaf4e31003ceb9d76846cb75fe3f0 Mon Sep 17 00:00:00 2001
From: Scott Berg <saberg3@wisc.edu>
Date: Fri, 22 Feb 2019 10:58:02 -0600
Subject: [PATCH] Add Regex to check if user is searching for all subjects or
 if subjects is blank.

---
 .../degree-planner/course-search/course-search.component.ts   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/app/degree-planner/course-search/course-search.component.ts b/src/app/degree-planner/course-search/course-search.component.ts
index 76da8b4..f2f7202 100644
--- a/src/app/degree-planner/course-search/course-search.component.ts
+++ b/src/app/degree-planner/course-search/course-search.component.ts
@@ -131,8 +131,8 @@ export class CourseSearchComponent implements OnInit, OnDestroy {
     (this.courseSearchForm.get(
       'subject',
     ) as AbstractControl).valueChanges.subscribe(value => {
-      // If the subject value is blank, reset the filtered subjects
-      if (value === '') {
+      // If the subject value is blank, or if the user is typing "all"
+      if (new RegExp('^([Aa]?[Ll]{0,2})$').test(value.trim())) {
         this.filteredSubjects = this.subjects;
         return;
       }
-- 
GitLab