<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#000080>Thank-you Kent - it works a treat!</FONT></DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV style="FONT: 10pt arial">----- Original Message -----
<DIV style="BACKGROUND: #e4e4e4; font-color: black"><B>From:</B> <A
title=kent37@tds.net href="mailto:kent37@tds.net">Kent Johnson</A> </DIV>
<DIV><B>To:</B> <A title=dineshbvadhia@hotmail.com
href="mailto:dineshbvadhia@hotmail.com">Dinesh B Vadhia</A> </DIV>
<DIV><B>Cc:</B> <A title=tutor@python.org
href="mailto:tutor@python.org">tutor@python.org</A> </DIV>
<DIV><B>Sent:</B> Sunday, June 01, 2008 4:25 AM</DIV>
<DIV><B>Subject:</B> Re: [Tutor] finding special character string</DIV></DIV>
<DIV><FONT color=#000080></FONT><BR></DIV>On Sun, Jun 1, 2008 at 6:48 AM, Dinesh
B Vadhia<BR><<A
href="mailto:dineshbvadhia@hotmail.com">dineshbvadhia@hotmail.com</A>>
wrote:<BR>> A text document has special character strings defined as "." +
"set of<BR>> characters" + ".". For example, ".sup." or ".quadbond." or
".degree." etc.<BR>> The length of the characters between the opening "." and
closing "." is<BR>> variable.<BR>><BR>> Assuming that you don't know
beforehand all possible special character<BR>> strings, how do you find all
such character strings in the text document?<BR><BR>Assuming the strings are
non-overlapping, i.e. the closing "." of one<BR>string is not the opening "." of
another, you can find them all with<BR> import re<BR>
re.findall(r'\..*?\.', text)<BR><BR>Kent<BR></BODY></HTML>