Re: [Tutor] parse text for paragraghs/sections

2009-04-20 Thread spir
Le Mon, 20 Apr 2009 09:07:01 -0700, "Dinesh B Vadhia" s'exprima ainsi: > t = """abc DEF ghi jkl MNO pqr""" > > ... pickup all text between the tags and and replace with > another piece of text. > > I tried > > t = re.sub(r"\[A-Za-z0-9]\", "DBV", t) > > ... but it doesn't work. You need:

Re: [Tutor] parse text for paragraghs/sections

2009-04-20 Thread Alan Gauld
"Dinesh B Vadhia" wrote in ... pickup all text between the tags and and replace with another piece of text. How do you do this with re? Preferably you don't, use an HTML parser. It is both easier and more reliable since it is almost impossible to handle all HTML constructs reliably usin

[Tutor] parse text for paragraghs/sections

2009-04-20 Thread Dinesh B Vadhia
Hi! I want to parse text and pickup sections. For example, from the text: t = """abc DEF ghi jkl MNO pqr""" ... pickup all text between the tags and and replace with another piece of text. I tried t = re.sub(r"\[A-Za-z0-9]\", "DBV", t) ... but it doesn't work. How do you do this with