Sunday, 15 June 2014

How to replace Javascript multiline comments with text in middle using regex -



How to replace Javascript multiline comments with text in middle using regex -

i trying replace 2 multiline comments (on single line) javascript text in middle. using build tool, reads entire file, , need replace specific string (made of comments) during build.

example:

var info = /*testthisdelete:start*/new date();/*testthisdelete:end*/

once replaced, should used this

var info = 4.6.88

try started:

"your file string".replace(new regexp('/\*testthisdelete\:start.*testthisdelete\:end\*/','m'), '"replacement text"');

see post lot of useful additional info: javascript replace/regex

javascript regex

No comments:

Post a Comment