title: Is my failed re.search an encoding issue?
body: <p>I am trying to strip characters that follow a pattern out of a .txt file but my regex search is returning none.The characters in question look different in the text file than when printed out in the command prompt. I am new to this and only have general knowledge about encoding and decoding. </p>
  
  <p>I believe txt file is encoded using ANSI (Windows-1252 ) and I am using python 3. I have tried searching using several regex patterns. Each regex worked when tested in RegExr, so I don't think that is the problem.</p>
  
  <p>The txt file is a bulk_extractor output file and it looks like this:</p>
  
  <pre><code># BANNER FILE NOT PROVIDED (-b option)
  # BULK_EXTRACTOR-Version: 1.5.5 ($Rev: 10844 $)
  # Feature-Recorder: email
  # Filename: W:\Migration\2010013\Working
  # Feature-File-Version: 1.1
  W:\Migration
  2010013\Working/Succession planning/Succession Plan Article
  W:\Migration\2010013\Working/Succession planning/Succession Plan Article▯-39612 j26@yahoo.com   397-1911 or&lt;/I&gt; j26@yahoo.com&lt;/P&gt; &lt;P&gt;\x0A&lt;TABLE 
  W:\Migration
  2010013\Working/Succession planning/Succession Plan Article
  W:\Migration\2010013\Working/Succession planning/Succession Plan Article▯-45963 jaime.brown@gmail.com   &lt;a href="mailto:jaime.brown@gmail.com?subject=Ask The
  
  </code></pre>
  
  <p>To clear a few things up first: I know the folder names are not the best but I am an archivist so we have to work with directories and files however they come into us. Also the email listed is an example and not anyone's actual email.</p>
  
  <p>With that out of the way, I am trying to strip the 'Article▯-#####' off the end of the file paths. </p>
  
  <p>When printed in the command prompt the ▯ changes to ô??o so that it now reads 'ô??o-#####'. Hence the 'ô??o' in the regex. 
  My code looks like this:</p>
  
  <pre><code>with open("email.txt", 'r', encoding = 'cp1252') as file:
      all_lines = file.readlines()
      no_header = all_lines[5:]
  print (no_header) #for testing
  
  pattern = re.compile('/(ô[?]{2}o[-][0-9]*)')
  for i in range(len(no_header)):
      test = re.search(pattern, no_header[i])
      print (test)
  </code></pre>
  
  <p>Since the regex worked in RegExr, I expected a string matching the pattern to be returned for each line. Instead the search returns none for each line. I have also tried searching for the rectangle character using its Unicode id U+25AF. That didn't work either.</p>
  
  <p>It seems that something is getting lost in translation.  I am used to working with Python 2.7 so I am guessing I am missing something here where encoding/decoding is concerned. </p>
  
  <p>Your help is appreciated! We are doing this to automate our metadata writing process and to protect individuals private email addresses.</p>