diff --git a/docs/api/index.html b/docs/api/index.html index fa4ff1e..c3765cb 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -438,12 +438,12 @@

XRegExp.exec(str, regex, [pos], [sticky]

Example

// Basic use, with named backreference
-let match = XRegExp.exec('U+2620', XRegExp('U\\+(?[0-9A-F]{4})'));
+let match = XRegExp.exec('U+2620', XRegExp('U\\+(?<hex>[0-9A-F]{4})'));
 match.groups.hex; // -> '2620'
 
 // With pos and sticky, in a loop
-let pos = 2, result = [], match;
-while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) {
+let pos = 3, result = [], match;
+while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) {
   result.push(match[1]);
   pos = match.index + match[0].length;
 }
diff --git a/src/xregexp.js b/src/xregexp.js
index b3a7f87..c7260d4 100644
--- a/src/xregexp.js
+++ b/src/xregexp.js
@@ -834,7 +834,7 @@ XRegExp.escape = (str) => String(nullThrows(str)).
  * match.groups.hex; // -> '2620'
  *
  * // With pos and sticky, in a loop
- * let pos = 2, result = [], match;
+ * let pos = 3, result = [], match;
  * while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) {
  *   result.push(match[1]);
  *   pos = match.index + match[0].length;
diff --git a/types/index.d.ts b/types/index.d.ts
index 4cd07cd..fa0b302 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -595,7 +595,7 @@ declare namespace XRegExp {
      * match.groups.hex; // -> '2620'
      *
      * // With pos and sticky, in a loop
-     * let pos = 2, result = [], match;
+     * let pos = 3, result = [], match;
      * while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) {
      *   result.push(match[1]);
      *   pos = match.groups.index + match[0].length;