I need help with the pattern to distinguish between single line comments and URLs using a regex, both of them have //
for example:
// this is a single line comment
var foo = "http://google.com";
var bar = 1; // This is another single line comment
I want to match comments only and ignore the URLs and other strings that are not comments.
Here is the regex I have tried:
/(\/\/.*)/g
I am trying to replace the single line comments in the production ready code.