diff --git a/src/docker.js b/src/docker.js
index <HASH>..<HASH> 100644
--- a/src/docker.js
+++ b/src/docker.js
@@ -372,7 +372,7 @@ Docker.prototype.parseSections = function(data, filename){
     var line = codeLines[i];
 
     // Only match against parts of the line that don't appear in strings
-    var matchable = line.replace(/(["'])((\\.|[^\1\\])*?)\1/g,'');
+    var matchable = line.replace(/(["'])(?:\\.|(?!\1).)*\1/g,'');
 
     if(params.multiLine){
       // If we are currently in a multiline comment, behave differently
Ok that was a bad regex. Try this instead then