[Python-de] Re: Python-de digest, Vol 1 #247 - 7 msgs
ctilch at gmx.de
Fri Oct 5 22:02:08 EDT 2001
pattern = re.compile('(\.|\!|\?)')
sample_text = """The quarrel is between our masters and us their men.
'Tis all one. I will show myself a tyrant. When I have fought
with the men, I will be cruel with the maids- I will cut off
The heads of the maids?
Ay, the heads of the maids, or their maidenheads.
Take it in what sense thou wilt.
They must take it in sense that feel it.
Me they shall feel while I am able to stand; and 'tis known I
am a pretty piece of flesh.
Greg. 'Tis well thou art not fish; if thou hadst, thou hadst been
poor-John. Draw thy tool! Here comes two of the house of
strCounter = 0
strStart = 0
strEnd = len(sample_text)
while strStart < strEnd:
match = pattern.search(sample_text,strStart)
strStart = match.end(0)
strCounter = strCounter + 1
strStart = strEnd
More information about the Python-de