title: Javascript regex .match() is null
body: <pre><code>console.log(r.message); //returns "This transaction has been authorized"
  if (r.message.match(/approved/).length &gt; 0 || r.message.match(/authorized/).length &gt; 0) {
  // ^ throws the error: r.message.match(/approved/) is null
  </code></pre>
  
  <p>Is this not the correct way to do matching in JavaScript?</p>
  
  <pre><code>success: function (r) {
      $('.processing').addClass('hide');
      if (r.type == 'success') {
          console.log(r.message);
          if (r.message.match(/approved/).length &gt; 0 || r.message.match(/authorized/).length &gt; 0) {
              triggerNotification('check', 'Payment has been accepted');
  
              //document.location = '/store/order/view?hash='+r.hash;
          } else {
              triggerNotification('check', r.message);
          }
      } else {
          $('.button').show();
  
          var msg = 'Unable to run credit card: '+r.message;
  
          if (parseInt(r.code) &gt; 0) {
              msg = msg+' (Error code: #'+r.code+')';
          }
          triggerNotification('x', msg);
      }
  },
  </code></pre>