title: How to remove part of URL
body: <p>Let's say my URL is this:</p>
  
  <pre><code>http://example.com/forum/index.php?topic=53.msg251#msg251
  </code></pre>
  
  <p>This part here, I can't figure out how to remove:</p>
  
  <pre><code>.msg251#msg251
  </code></pre>
  
  <p>I did try though, I'm not sure if I am even close to doing it right.</p>
  
  <pre><code> $linkraw = $items-&gt;link;
   $linkpattern = '/^.msg247#msg247/';
   $link = preg_match($linkpattern, $linkraw);
  </code></pre>
  
  <p>What is the correct way of doing this? I am trying to learn.</p>