title: Python string.replace regular expression
body: <p>I have a parameter file of the form:</p>
  
  <pre><code>parameter-name parameter-value
  </code></pre>
  
  <p>Where the parameters may be in any order but there is only one parameter per line.  I want to replace one parameter's <code>parameter-value</code> with a new value.</p>
  
  <p>I am using a line replace function <a href="https://stackoverflow.com/questions/39086/search-and-replace-a-line-in-a-file-in-python">posted previously</a> to replace the line which uses Python's <a href="http://www.tutorialspoint.com/python/string_replace.htm%20String.Replace" rel="noreferrer"><code>string.replace(pattern, sub)</code></a>.  The regular expression that I'm using works for instance in vim but doesn't appear to work in <code>string.replace()</code>. </p>
  
  <p>Here is the regular expression that I'm using:</p>
  
  <pre><code>line.replace("^.*interfaceOpDataFile.*$/i", "interfaceOpDataFile %s" % (fileIn))
  </code></pre>
  
  <p>Where <code>"interfaceOpDataFile"</code> is the parameter name that I'm replacing (/i for case-insensitive) and the new parameter value is the contents of the <code>fileIn</code> variable. </p>
  
  <p>Is there a way to get Python to recognize this regular expression or else is there another way to accomplish this task?</p>