title: User Input match using regular expression in python
body: <pre><code>import re
  path ='C:\\Users\\username\\Desktop\\name.txt'
  shakes = open(path, 'r')
  love = open("store.txt", "w")
  
  for line in shakes:
      if re.match("**(.*)(P|P)ython(.*)**", line):
          print &gt;&gt; store, line,
  </code></pre>
  
  <p>In the above example i have used "Python" as the text to be searched. But i need the user to input the word and search. </p>
  
  <p>For example :</p>
  
  <pre><code>import re
  book=input("Enter the book name")
  path ='C:\\Users\\username\\Desktop\\name.txt'
  shakes = open(path, 'r')
  love = open("store.txt", "w")
  
  for line in shakes:
      if re.match(book, line):
          print &gt;&gt; store, line,
  </code></pre>
  
  <p>This program is running and asking "Enter the book name", when the book name is entered(eg : digital), it is returning error stating <code>name 'digital' is not defined.</code></p>
  
  <p>Help with this.</p>
  
  <p>How to get a string from the user and search it in the file to find the match.</p>