title: How do I match a whole sentence in Javascript Regular Expressions?
body: <p>I need to create a Regular Expression (in Javascript) that will match a specific sentence structure.  In my case, it's "Course ### day ###", where ### can be any 1 to 3 digit number.  Additionally, it can be "week" instead of "day", so "Course ### week ###" is also valid.</p>
  
  <p>So far, I've come up with:</p>
  
  <pre><code>var regTest=/^(Course) \d{1,3} (day)|(week) \d{1,3}$/
  </code></pre>
  
  <p>The problem is that this expression matches "Course 9 day 1", which is what I want, but it would also match "Course 9 day 1 scheduled on 07/01/09".</p>
  
  <p>In other words, the following returns a value of 0:</p>
  
  <pre><code>"Course 9 day 1".search(regTest)
  </code></pre>
  
  <p>But this one also returns 0:</p>
  
  <pre><code>"Course 9 day 1 scheduled on 07/01/09".search(regTest)
  </code></pre>
  
  <p>I want the first test to return 0, but I want the second one to return -1.  I need the expression to ONLY match up until the ### following day/week.  How do you make it to stop at that point?</p>