Regular Expression for comments but not within a “string” / not in another container
问题 So I need a regular expression for finding single line and multi line comments, but not in a string. (eg. "my /* string" ) for testing ( # single line, /* & */ multi line): # complete line should be found lorem ipsum # from this to line end /* all three lines should be found */ but not here anymore var x = "this # should not be found" var y = "this /* shouldn't */ match either" var z = "but" & /* this must match */ "_" SO does the syntax display really well; I basically want all the gray text