title: \Z end of line reagex count finding things not at absolute end of line
body: <p>I am trying to find and count all things matching a certain string/strings within a larger string. I am having trouble when it comes to counting a string that ends with ]) or ] at the very end of a string. 
  Example of code below:</p>
  
  <p>I have tried $ instead of \Z which returns the same result. Some searching led me to believe that \z should be only the final end of the string, but it returns an error about an unexpected exit. </p>
  
  <pre><code>    import pandas as pd
  
      test= {'s':[')-[#8]-[#6]-[#8])-[#7]', '-[#6]-[#8])-[#8]']}
      df = pd.DataFrame(data = test)
      All = df['s'].str.count('-\[#8\]\)|\Z')
      print(All)
  </code></pre>
  
  <p>I should count 1 instance of '-[#8])|\Z' using count in the first row and 2 instances in the second row as I want to find -[#8]) or -[#8] only at the end of a string but not -[#8]-. However I find 2 instances in both rows.</p>