[Tutor] regular expression question

Mike Hall michael.hall at critterpixstudios.com
Wed Mar 9 02:34:24 CET 2005


I'd like to get a match for a position in a string preceded by a 
specified word (let's call it "Dog"), unless that spot in the string 
(after "Dog") is directly followed by a specific word(let's say "Cat"), 
in which case I want my match to occur directly after "Cat", and not 
"Dog."

I can easily get the spot after "Dog," and I can also get it to ignore 
this spot if "Dog" is followed by "Cat." But what I'm having trouble 
with is how to match the spot after "Cat" if this word does indeed 
exist in the string.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 528 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20050308/cce9cb93/attachment-0001.bin


More information about the Tutor mailing list