The former thing is easy - just using string replace() method
The latter thing is more difficult, but I found solution here: Find Hyperlinks in Text using Python (twitter related)
But now I need to implement "Edit Article" function, so I have to do the reverse action on this.
Thanks! And I'm sorry for my poor English.
Since you are using the answer from that other question your links will always be in the same format. So it should be pretty easy using regex. I don't know python, but going by the answer from the last question:
import re myString = 'This is my tweet check it out <a href="http://tinyurl.com/blah">http://tinyurl.com/blah</a>' r = re.compile(r'<a href="(http://[^ ]+)">(http://[^ ]+)</a>') print r.sub(r'\1', myString)