开发者

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

开发者 https://www.devze.com 2023-01-29 22:29 出处:网络
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

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

精彩评论

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