title: How can I remove characters overflow from the target one
body: <p>I'm <strong>scraping</strong> web but I'm stack with an error and I failed to handle it</p>
  <p>I've the following url but can't work for me to make it work require to remove all characters
  after <code>jpg</code> and I tried it with regular expression but I couldnt and I dont want to count
  overflowing characters and index on url to remove it because it will not work on all
  of image</p>
  <pre><code>https://upload.wikimedia.org/wikipedia/commons/2/25/Lebron_wizards_2017_%28cropped%29.jpg/498px-Lebron_wizards_2017_%28cropped%29.jpg
  
  </code></pre>
  <p><strong>this is the code I've tried so far</strong></p>
  <pre><code>regex = re.sub('[^*\w]/+\w', '', image)
  
  # and
  
  sep = 'jpg/'
  rest = image.split(sep, 1)[0]
  print(rest)
  </code></pre>
  <p>but I failed and I also check here <a href="https://stackoverflow.com/questions/904746/how-to-remove-all-characters-after-a-specific-character-in-python">this question</a> but I can't find any solution because of my url contains weird and similar characters.</p>
  <p><strong>an expected result looks like this</strong></p>
  <pre><code>https://upload.wikimedia.org/wikipedia/commons/2/25/Lebron_wizards_2017_%28cropped%29.jpg
  </code></pre>