diff --git a/files/en-us/web/javascript/reference/global_objects/regexp/exec/index.html b/files/en-us/web/javascript/reference/global_objects/regexp/exec/index.html index 22034c7e8939792..166a1d692eaed22 100644 --- a/files/en-us/web/javascript/reference/global_objects/regexp/exec/index.html +++ b/files/en-us/web/javascript/reference/global_objects/regexp/exec/index.html @@ -184,6 +184,9 @@

Finding successive matches

Also, be sure that the global flag ("g") is set, or it will also cause an infinite loop.

+ +

In addition, when matching zero-length characters (e.g. /^/gm), + ++regexp.lastIndex can be used to avoid infinite loops.

Using exec() with RegExp literals