I'm trying to do remove javascript comments via regex in C# and have become stuck. I want to remove any occurrences of double slash // style comments.
My current regex is (?<!:)//[^\r\n]* which will catch all comments and prevent matching of http://. However, the negative lookbehind was lazy and of course bit me back in the following test case:
var XSLPath = "//" + Node;
So I'm looking for a regular expression that will perform a lookbehind to see if an even number of double quotes (") occurs before the match. I'm not sure if this is possible. Or maybe there's a better way to do this?