/* One " two */ a = b + 4; /* three " four */ #### s { ( [^"'/]* # Not a string, character or comment. | "[^\\"]*(?:\\.[^\\"]*)*" # String. | '[^\\']*(?:\\.[^\\']*)*' # Char. | / (?![*]) # Slash, not a comment. ) | ( /[*] [^*]* (?: [*] [^*/]* )* [*]/ ) # Comment. } { $2 ? "" : $1 }gsex;