【发布时间】:2020-07-04 14:53:17
【问题描述】:
我有以下文本作为输入。
This is specified input. This is Specified input.
我想要下面的输出。
This is <span>specified</span> input. This is <span>Specified</span> input.
如果我这样做str.replace(\specified\gi, '<span>specified</span>'),它将像这样替换
This is <span>specified</span> input. This is <span>specified</span> input.
如何用匹配的元素替换这个字符串
【问题讨论】:
标签: javascript html regex dom