title: How to separate regex in javascript Hours format
body: <p>I have some problem to define hours time, i want to separate hours time to 3 time type morning, evening, and night.
  if time start from 00:00 to 10:00 the type time is morning,
  if time start from 10:01 to 18:00 the type time is evening,
  if time start from 18:01 to 23:59 the type time is night,
  i have code jquery like this </p>
  
  <pre><code>$(document).ready(function(){
      $('#submit').on('click',function(){
  
          var hrs=$('#hours').val();
          var nm=$('#scedule').val();
  
          var patt = new RegExp("^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$");
              var patts = patt.test(hrs);
  
          //morning   =   00:00 - 10:00
          var morn = new RegExp("^([0-9]|0[0-9]|1[0-9]):[0-5][0-9]$");
              var morning = morn.test(hrs);
  
          //evening   =   10:01 - 18:00
          var even = new RegExp("^(1[0-9]|[0-9]):[0-5][0-9]$");
              var evening = even.test(hrs);
  
          //night =   18:01 - 00:00
          var nig = new RegExp("^(1[0-9]|2[0-3]):[0-5][0-9]$");
              var night = nig.test(hrs);
  
          if ( patts == morning ) {
              alert('This is Morning');
          } else if (patts == evening){
              alert('This is Evening');
          } else if (patts == night){
              alert('This is night');
          } else {
              alert('Format is wrong');
          }
      });
  });
  </code></pre>
  
  <p>and this is my form HTML :</p>
  
  <pre><code>    Scedule : &lt;input type="text" id="scedule"&gt;&lt;br&gt;
      Time : &lt;input type="text" id="hours"&gt;&lt;br&gt;   
      &lt;input type="submit" value="submit" id="submit"&gt;&lt;br&gt;
  </code></pre>