View Single Post
Old Nov 27th, 2005, 1:42 PM   #5
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,890
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
I've noticed I've used this one quite often in my code:

def get_between(string, start, end):
    return string.split(start)[-1].split(end)[0]

example:
print get_between("blah <a href='http://www.google.com'>blah</a> blah", 
    "href='", "'>")
>>> http://www.google.com
Sane is online now   Reply With Quote