title: How to delete vertical line from string
body: <p>For some reason I can't delete the vertical bar from a string. This string was extracted from an html tag (BeautifulSoup 4).    </p>
  
  <p>The string comes from the title meta tag of a site.  </p>
  
  <p>Example input: 'How to run very fast | running.com'<br>
  By the if statement, the string still contains the |, but it is not detected in name and never enters the if statement...</p>
  
  <pre><code>name = title.text.encode('ascii', 'ignore').strip()
  
  #remove everything after | because often it is SEO stuff
  name = re.sub('\|', '',  name)  #fails
  if "|" in name:
      lineIndex = name.index('|')
      name = name[:lineIndex]
  </code></pre>