title: Regular expression url pattern matching for the end of the string
body: <p>I'm trying to match wikipedia entry page only, which includes:</p>
  
  <ul>
  <li><a href="https://en.wikipedia.org/wiki/Quantum_mechanics" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Quantum_mechanics</a></li>
  <li><a href="https://en.wikipedia.org/wiki/Apple" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Apple</a></li>
  </ul>
  
  <p>But excludes:</p>
  
  <ul>
  <li><a href="https://en.wikipedia.org/wiki/Wikipedia:Community_portal" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Wikipedia:Community_portal</a></li>
  <li><a href="https://en.wikipedia.org/wiki/Wikipedia:About" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Wikipedia:About</a></li>
  </ul>
  
  <p>Basically I want to weed out the ones that has a colon in the last part.
  This will match both of the cases:</p>
  
  <p><code>const regex = /https?:\/\/.*wikipedia.org\/wiki\/\w*/</code></p>
  
  <p>I thought if I put <code>$</code> in the end it will match the first case only, because it matches cases where it ends with words only: </p>
  
  <p><code>const regex = /https?:\/\/.*wikipedia.org\/wiki\/\w*$/</code></p>
  
  <p>But this won't match any of them. Can anyone help explain why?</p>