title: How to use regex to tell if first and last character of a string match?
body: <p>I'm relatively new to using Python and Regex, and I wanted to check if strings first and last characters are the same.</p>
  
  <p>If first and last characters are same, then return 'True' (Ex: 'aba')
  If first and last characters are not same, then return 'False' (Ex: 'ab')</p>
  
  <p>Below is the code, I've written:</p>
  
  <pre><code>import re
  string = 'aba'
  pattern = re.compile(r'^/w./1w$')
  
  matches = pattern.finditer(string)
  for match in matches
     print (match)
  </code></pre>
  
  <p>But from the above code, I don't see any output</p>