title: Can't Access JS Regex Result - Cannot read property '1' of null
body: <p>I have some code where I'm scraping URLs from a page and then using a regex to get the text between two strings. When I do that, I get the match that I want but I can't access the result.</p>
  
  <pre><code>evaluated.forEach(function(element) {
      console.log(element.match(/.com\/(.*?)\?fref/)[1]);
  }, this);
  </code></pre>
  
  <p>If I remove the <code>[1]</code>, I see the results in the console as:</p>
  
  <pre><code>[
      '.com/jkahan?fref',
      'jkahan',
      index: 20,
      input: 'https://www.example.com/jkahan?fref=pb&amp;hc_location=friends_tab' 
  ]
  </code></pre>
  
  <p>But when I add the <code>[1]</code> to access the result I want, I get:</p>
  
  <blockquote>
    <p>TypeError: Cannot read property '1' of null.</p>
  </blockquote>