title: JavaScript: RegEx - Do not return match1 match2 etc
body: <p>I'm trying to adopt this regex for my needs:</p>
  
  <pre><code>(?:^|\s)(?:https?:\/\/)?(?:\w+(?=\.).)?(?&lt;name&gt;.*).(?&lt;tld&gt;(?&lt;=\.)\w+)
  </code></pre>
  
  <p>Demo:
  <a href="https://regex101.com/r/lI2lB4/2" rel="nofollow">https://regex101.com/r/lI2lB4/2</a></p>
  
  <p>I would like to return a match for all entries like:</p>
  
  <ul>
  <li>www.example.com</li>
  <li>example.com</li>
  <li><a href="http://example.com" rel="nofollow">http://example.com</a></li>
  <li><a href="http://www.example.com" rel="nofollow">http://www.example.com</a></li>
  </ul>
  
  <p>but not for</p>
  
  <ul>
  <li>example.</li>
  <li><a href="http://www.example" rel="nofollow">http://www.example</a></li>
  <li>www.example</li>
  </ul>
  
  <p>Now the regex shown above is working fine, but it returns different matches (Match 1, Match 2, ...) - but would like to get only one result: <code>Matching</code> or <code>not matching</code>.</p>
  
  <p>As a result I would like to use</p>
  
  <pre><code>regExDomain.test($regExDomain.test(input.val()))
  {
  console.log('valid');
  }
  else
  {
  console.log('invalid');
  }
  </code></pre>
  
  <p>The problem is: The regEx above seems always to return "valid".</p>
  
  <p>Any ideas how to do that?</p>