<div>Hello,</div>
<div>&nbsp;</div>
<div>I am trying to write a script that takes strings from a text file and searches to see if they are present in another text file...here is the code:</div>
<div>&nbsp;</div>
<div>import os<br>import re</div>
<div>
<p>search = open(&quot;c:\python24\scripts\pii\expected_rules_results.txt&quot;)</p>
<p>def find(x):<br>&nbsp;file = open(&quot;c:\python24\scripts\pii\dave.txt&quot;)<br>&nbsp;regexp = re.compile(x)<br>&nbsp;for line in file.readlines():<br>&nbsp;&nbsp;if regexp.search(line):<br>&nbsp;&nbsp;&nbsp;print &quot;Found&quot;, x<br>&nbsp;&nbsp;&nbsp;break<br>&nbsp;<br>
&nbsp;&nbsp;&nbsp;<br>&nbsp;file.close()&nbsp;<br>&nbsp;</p>
<p>for x in search:<br>&nbsp;find(x)<br>search.close()</p>
<p>&nbsp;</p>
<p>Unfortunately the strings I will be searching for contain numerous &quot;*&quot; that cause an error. For example, when try to search for:</p>
<p><a href="http://www.widget.com/personal_firewall.csp/?pin=****{6">http://www.widget.com/personal_firewall.csp/?pin=****{6</a>}</p>
<p>I get the error message:</p>
<p>Traceback (most recent call last):<br>&nbsp; File &quot;C:\Python24\scripts\PII\search<br>&nbsp;&nbsp;&nbsp; find(x)<br>&nbsp; File &quot;C:\Python24\scripts\PII\search<br>&nbsp;&nbsp;&nbsp; regexp = re.compile(x)<br>&nbsp; File &quot;C:\Python24\lib\sre.py&quot;, line
<br>&nbsp;&nbsp;&nbsp; return _compile(pattern, flags)<br>&nbsp; File &quot;C:\Python24\lib\sre.py&quot;, line<br>&nbsp;&nbsp;&nbsp; raise error, v # invalid expressio<br>sre_constants.error: multiple repeat</p>
<p>&nbsp;</p>
<p>Anyone know how to get around this?</p></div>