title: How to find similar values from list but not exact?
body: <p>I have more than 500k records of city names, But data is not correctly typed for example word <code>AHMADNAGAR</code> is typed in ways below,</p>
  <pre><code> 1. AEHMADNAGAR
   2. AHEMADNAGR
   3. AHMAD NAGAR
   4. AHMADNAGGAR
  </code></pre>
  <p>This is an example of only one city, I have to scan more than 500k records &amp; want to <strong>find similar words but not exactly similar.</strong></p>
  <p>I created the <code>.txt</code> file and I'm sharing the link, where I included 17K Cities, please see file <a href="https://raw.githubusercontent.com/kaustubhk24/Indian-Banks-Data/main/DATA/RAW/districts.txt" rel="nofollow noreferrer">Here</a></p>
  <p>What I tried?</p>
  <pre><code>from difflib import get_close_matches
          
  def closeMatches(patterns, word):
      print(get_close_matches(word, patterns))
  
      
  citylist=['AHMADNAGAR','XYZ','AEHMADNAGAR','AHEMADNAGR','AHMADNAGAR','AHMADNAGGAR','ABC','test','test2']
       for city in citylist:  
           closeMatches(patterns, city)
  </code></pre>
  <p>Expected output: (as we're passing <code>city</code> runtime it should print similar values but not exactly similar, even I already removed similar values, We don't have any duplicates)</p>
  <pre><code>example output of one city ( we have 500K cities, please check file, I included some of them there )
  
      AHMADNAGAR
      AEHMADNAGAR
      AHEMADNAGR
      AHMADNAGAR
      AHMADNAGGAR
  </code></pre>
  <p>The problem here is, can not pass <code>city</code> here to create <code>pattern</code> manually &amp; another thing is it is not showing all variations.</p>
  <p>I learned from my friend that we can use <code>regex</code>, but how? Is there any way to create <code>regex runtime</code> and match it with all records</p>
  <p>Just want to get the list of similar cities</p>