title: PHP regex for image name with numbers
body: <p>I have images with names such as:</p>
  
  <pre><code>img-300x300.jpg
  img1-250x270.jpg
  </code></pre>
  
  <p>These names will be stored in a string variable. My image is in Wordpress so it will be located at e.g. </p>
  
  <p>mywebsite.com/wp-content/uploads/2012/11/img-300x300.jpg </p>
  
  <p>and I need the string to be changed to </p>
  
  <p>mywebsite.com/wp-content/uploads/2012/11/img.jpg</p>
  
  <p>I need a PHP regular expression which would return img.jpg and img1.jpg as the names.</p>
  
  <p>How do I do this?</p>
  
  <p>Thanks</p>
  
  <p>Addition</p>
  
  <p>Sorry guys, I had tried this but it didn't work</p>
  
  <pre><code>$string = 'img-300x300.jpg'
  $pattern = '[^0-9\.]-[^0-9\.]';
  $replacement = '';
  echo preg_replace($pattern, $replacement, $string);
  </code></pre>