<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: regular code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Mon, 06 Oct 2008 10:27:46 GMT</pubDate>
    <description>DZone Snippets: regular code</description>
    <item>
      <title>Handling Accented Characters with Python Regular Expressions</title>
      <link>http://snippets.dzone.com/posts/show/1588</link>
      <description>[A-z] just isn't good enough!&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import re&lt;br /&gt;string = 'rich&#233;'&lt;br /&gt;print string&lt;br /&gt;rich&#233;&lt;br /&gt;&lt;br /&gt;richre = re.compile('([A-z]+)')&lt;br /&gt;match = richre.match(string)&lt;br /&gt;print match.groups()&lt;br /&gt;('rich',)&lt;br /&gt;&lt;br /&gt;richre = re.compile('(\w+)',re.LOCALE)&lt;br /&gt;match = richre.match(string)&lt;br /&gt;print match.groups()&lt;br /&gt;('rich',)&lt;br /&gt;&lt;br /&gt;richre = re.compile('([&#233;\w]+)')&lt;br /&gt;match = richre.match(string)&lt;br /&gt;print match.groups()&lt;br /&gt;('rich\xe9',)&lt;br /&gt;&lt;br /&gt;richre = re.compile('([\xe9\w]+)')&lt;br /&gt;match = richre.match(string)&lt;br /&gt;print match.groups()&lt;br /&gt;('rich\xe9',)&lt;br /&gt;&lt;br /&gt;richre = re.compile('([\xe9-\xf8\w]+)')&lt;br /&gt;match = richre.match(string)&lt;br /&gt;print match.groups()&lt;br /&gt;('rich\xe9',)&lt;br /&gt;&lt;br /&gt;string = 'rich&#233;&#241;'&lt;br /&gt;match = richre.match(string)&lt;br /&gt;print match.groups()&lt;br /&gt;('rich\xe9\xf1',)&lt;br /&gt;&lt;br /&gt;richre = re.compile('([\u00E9-\u00F8\w]+)')&lt;br /&gt;print match.groups()&lt;br /&gt;('rich\xe9\xf1',)&lt;br /&gt;&lt;br /&gt;matched = match.group(1)&lt;br /&gt;print matched&lt;br /&gt;rich&#233;&#241;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 27 Feb 2006 21:20:20 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1588</guid>
      <author>offspinner ()</author>
    </item>
  </channel>
</rss>
