Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私のWebアプリケーション(django)では、次のようなものを(ループで)使用して、内部リンクで特別な単語を自動的に変更します。
value = re.sub(r'\b' + keyword.name +r'\b', unicode(internal_link), value, flags=re.UNICODE|re.IGNORECASE)
すでにリンクされている単語を変更しない方法はありますか?
(例えば、>と</a>文字の間、またはそれ以上のもの)。
>
</a>
このようなもの:
reg = r'<//a{0}>|\b{0}\b'.format(keyword.name) value = re.sub(reg, lambda match: match.group(1) if match.group(1) else unicode(internal_link), value, flags=....)