怎么对正则表达式匹配的字符串加上span包裹起来?
varre=/world|people|Pizar/gvarstr="Disneyfilmsarefavoredbypeopleallaroundtheworld,iti...
var re=/world|people|Pizar/g
var str = "Disney films are favored by people all around the world, it is known to all that many of the movies are produced by Pizar animation studio";
有一个正则表达式,还有一个字符串,我想为这个字符串中所有匹配正则表达式的单词分别都加上一个< span >包裹起来,例如:< span >world< /span >一样。请问怎么才能办到呢? 展开
var str = "Disney films are favored by people all around the world, it is known to all that many of the movies are produced by Pizar animation studio";
有一个正则表达式,还有一个字符串,我想为这个字符串中所有匹配正则表达式的单词分别都加上一个< span >包裹起来,例如:< span >world< /span >一样。请问怎么才能办到呢? 展开
1个回答
展开全部
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询