[Tutor] Newbie - regex question

bob gailer bgailer at gmail.com
Tue Aug 31 00:11:10 CEST 2010


  On 8/30/2010 4:52 PM, Sam M wrote:
> Hi Guys,
>
> I'd like remove contents between tags <email> that matches pattern 
> "WORD1" as follows:
>
> Change
> "stuff <email>WORD1-EMAILID at DOMAIN.COM</email> more stuff 
> <email>WORD1-EMAILID at DOMAIN.COM</email> still more stuff 
> <email>WORD2-EMAILID at DOMAIN.COM</email> stuff after WORD2 
> <email>WORD1-EMAILID at DOMAIN.COM</email>"
>
> To
> "stuff  more stuff  still more stuff 
> <email>WORD2-EMAILID at DOMAIN.COM</email> stuff after WORD2 "
>
> The following did not work
> newl = re.sub (r'<email>WORD1-.*</email>',"",line)

Please remember to explain "did not work".
Did you get an exception?
Did you get unexpected results? If so what were they?

-- 
Bob Gailer
919-636-4239
Chapel Hill NC



More information about the Tutor mailing list