title: I am having trouble making a program that eliminates non-alphabetical characters
body: <p>I am having trouble getting my program to detect non-alphabetical characters and am stuck. Earlier I tried to use the <code>re.search</code> function, (ie re.search('[a-z]') . I currently do not understand this function and opted for code I can currently understand. If someone could explain the regex function and help me with my code it I would appreciate it.</p>
  
  <p>Here is my code:</p>
  
  <pre><code># Eliminates characters that are not part of the alphabet from string
  def eleminate_unknown(input_string):
      alpabet_list= ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z')
  
      #checks if string is upper case and makes it lower case
      if (input_string != input_string.lower()):
          print 'Upper case letters detected. Converting string to lower case.'
          input_string = input_string.lower()
      print("eleminating unknown charecters from %s") %input_string
  
      #creates visable division
      print '___________________________________________________________'
  
      for count in range(-1,(len(input_string)-1)): #need to subtract one from len of string to match index
          print input_string
  
          #looks for and eliminates characters not in lower case alphabet
  
          if (input_string[count] not in alpabet_list == False):
              print "String index %s eleminated!" %count
              print "The charecter %s died a terrable death" %input_string[count]
              print input_string[:count] + input_string[count+1:]
              input_string = input_string[:count] + input_string[count+1:]
              count = count+1
          else:
              count = count+1
              print "Index %s is not eliminated. Character %s is recognized and lives to die another day." % (count, input_string[count])
      print input_string
  </code></pre>