开发者

How to find the index of a praticular word in the whole sentence

i want 开发者_运维问答to find a text named "footer= XXX" in a text document and replace the XXX with my own value. The problem here is that this footer value repeats in lot of areas in the document with different values assigned to it. Any idea of how to do it?


str.replace(/footer=(.*?)\s/g, 'footer=whatever');

See it on jsFiddle.

You didn't mention what the end delimiter is, so I used white space. You may want to use a word boundary (\b).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜