javascript - Find string with "//" and replace from "//" up to the end -
supposed inlinediv_num_text has value of: //abc
must replaced @comment@
and abc //cde
must replaced abc @comment@
please fix condition did, it's not working
//wrap inline comments if(/[^]*//[^]*/g.test(inlinediv_num_text)){ inlinediv_num_text = inlinediv_num_text.replace(///[^]*/g, "@comments@"); }
you have escape each \
. try changing search regex /\\\\\s*/
http://rubular.com/r/qh0wwd2wnh
note: languages require escape \
twice. 1 base language, , 1 regex. if above doesn't work, might need along lines of /\\\\\\\\\\s*/
Comments
Post a Comment