src/jdk/nashorn/internal/objects/NativeRegExp.java

Print this page

        

@@ -673,11 +673,11 @@
         }
 
         start = matcher.find(start) ? matcher.start() : -1;
 
         if (global) {
-            setLastIndex(matcher.end());
+            setLastIndex(start == -1? -1 : matcher.end());
         }
 
         return start;
     }