title: MySQL query using LIKE and a wildcard to match anything but empty string
body: <p>I have a table called images which has a field image_filename. I have noticed that some images that have been stored have characters after the file extension and these do not load properly. So say the filename is image.jpg this is fine and can be ignored, however if the filename is image.jpg%3fhf43h408 then I need to delete this image. This is my query so far to try and select all of the images that have stuff after the extension:</p>
  
  <pre><code>SELECT `images`.* FROM images
  WHERE `images`.`image_filename` LIKE '%.jpg\%' 
  </code></pre>
  
  <p>This returns all images though even if there is nothing after the extension. How do I get the query to only return images where there is something after the extension. To add extra confusion the stuff after the extension seems to always begin with a percentage sign hence why I am trying to escape it in my query to be treated as a literal percentage sign rather than a wildcard. I have tried the following also:</p>
  
  <pre><code>SELECT `images`.* FROM images
  WHERE `images`.`image_filename` LIKE '%.jpg\%' escape '\'
  </code></pre>
  
  <p>But this doesn't work and it just says I have an error</p>