title: Test whether a string matches a regex?
body: <p>I need to check whether a string matches a regular expression.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function isEqual(str)
  {
    var re = /\/users\/(.+)/;
    
    // code
  }
  
  // Some examples of requests
  
  console.log(isEqual('/users/1'));
  console.log(isEqual('/users/1/Nikita'));
  console.log(isEqual('/users'));</code></pre>
  </div>
  </div>
  </p>