Hello everyone...<br><br>I have a small problem...I&#39;m trying to match a pound symbol in a document using Python.  (Version 2.5.2, although I also ran this under 2.6 and it seemed to give the same result.  But ultimately I need correct code for 2.5.2)<br>
<br>Here&#39;s the code:<br><br>#!/usr/bin/env python<br># -*- coding: utf-8 -*-<br>import re<br><br>########## This part doesn&#39;t work doesn&#39;t work right...but at least it matches<br><br>text = &quot;The Price £7&quot;<br>
pattern = u&quot;£\d&quot;<br><br>m = re.search(pattern, text, re.UNICODE)<br>print m.group(0)<br><br>########## This part fails to get a match completely<br><br>pattern = u&quot; £\d&quot;<br>m = re.search(pattern, text, re.UNICODE)<br>
print m.group(0)<br><br><br>Now what I would expect to happen is that the first half of the code would print out:<br>£7<br><br>Instead it prints out:<br>�7<br><br>Which is doubly weird cause it can print the pound charcter in the pattern...<br>
<br>The second half of the code should do the same thing except include the space at the beginning.<br><br>So I expect:<br> £7<br><br>but instead get an exception.<br><br>I&#39;ve tried (I believe) every combination of using re.UNICODE or not, as well as quoting the strings with u or just leaving them as normal.  Nothing seemed to solve the problem.<br>
<br>Thank you for the help!<br>