有条件替换尖括号的正则表达式 [英] Regular Expression for Conditional Substitution of Angle Brackets
本文介绍了有条件替换尖括号的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以创建单个正则表达式来替换<和>及其在Komodo Edit中的实体等效项?
Is it possible to create a single regexp to replace < and > with their entity equivalents in Komodo Edit?
s/<|>/<|>/
推荐答案
我猜测您可能必须将&
转换为&
,依此类推.
I'm guessing that you may have to convert &
to &
and so on.
如果是这种情况,则很可能使用您使用的任何语言/平台的库或函数(例如,在Java中,请查看
If this is the case there's most likely a library or function in whichever language/platform you're using (e.g. in Java check out StringEscapeUtils). Indicate which language you're using and someone here will no doubt point you to something appropriate.
这篇关于有条件替换尖括号的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文