Regular Expression

patrick.waldo at patrick.waldo at
Tue Oct 23 00:29:38 CEST 2007


I'm trying to learn regular expressions, but I am having trouble with
this.  I want to search a document that has mixed data; however, the
last line of every entry has something like C5H4N4O3 or CH5N3.ClH.
All of the letters are upper case and there will always be numbers and
possibly one .

However below only gave me none.

import os, codecs, re

text = 'C:\\text_samples\\sample.txt'
text =,'r','utf-8')

test = re.compile('\u+\d+\.')

for line in text:

More information about the Python-list mailing list