python: adierazpen erregularrakaz (regex) link-ek html-ra bihurtu

baguez kallue hartzien python-eri, oingutan texto batetik link-ek html-ra pasa’kuz #!/usr/bin/env python # -*- coding: utf-8 -*- import re text = “http://aaaaa       https://bbbbb ftp://ccccc\n http://dddddddd” m = re.sub(r'(?i)(^|\s+|\A)(http|https|ftp)(\://\S+)(\s+|\Z|$)’, ‘\\1<a href=\”\\1\\2\” onclick=\”window.open(this.href); return false;\”>\\2\\3</a>\\4’, text) print m Erantzune:   <a href=”http://aaaaa” onclick=”window.open(this.href); return false;”>       <a href=”https://bbbbb” onclick=”window.open(this.href); return false;”> <a href=”ftp://ccccc” onclick=”window.open(this.href); return false;”>  <a href=”http://dddddddd” […]