0

Hi Can anyone please help get all the single line and multiline comment in a given javascript string using regex.

Idea is to replace the single and multiline comment with empty quotes. so that I get the valid code from the string.

I am looking for a solution in javascript with regex.

Shiras
  • 115
  • 1
  • 1
  • 7
  • 2
    http://stackoverflow.com/questions/5989315/regex-for-match-replacing-javascript-comments-both-multiline-and-inline – jgroenen Aug 14 '13 at 11:33
  • 1
    _"Idea is to replace the single and multiline comment with empty quotes."_ - So `alert('test'); /* a test */` will be become `alert('test'); ""`? Or do you mean you want to replace comments with an empty string? **Please show a sample input with corresponding desired output.** _"so that I get the valid code from the string."_ - But JS comments _are_ valid within JS... – nnnnnn Aug 14 '13 at 11:36

0 Answers0