开发者

Replace only whole word in javascript [duplicate]

This question already has an answer here: Closed 11 years ago.

Possible Duplicate:

Match and replace whole words in javascript

I want to replace in JavaScript the word "microsoft" with "stackoverflow".

But I only want it to replace the whole word - so I don't want "microsoft microsftttt" 开发者_Python百科to be turned into "stackoverflow stackoverflowttt".


You can add ' ' to begin of string & end of string, replace ' microsoft ' to ' stackoverflow ' and cut ' ' , added before it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜