Skip to content

Commit 39e4721

Browse files
committed
Fix docs/examples (fixes #344)
1 parent 2dcf16d commit 39e4721

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

docs/api/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,12 @@ <h2 id="exec"><code>XRegExp.exec(<span class="plain">str, regex, [pos], [sticky]
438438

439439
<h3>Example</h3>
440440
<pre class="sh_javascript">// Basic use, with named backreference
441-
let match = XRegExp.exec('U+2620', XRegExp('U\\+(?<hex>[0-9A-F]{4})'));
441+
let match = XRegExp.exec('U+2620', XRegExp('U\\+(?&lt;hex>[0-9A-F]{4})'));
442442
match.groups.hex; // -> '2620'
443443

444444
// With pos and sticky, in a loop
445-
let pos = 2, result = [], match;
446-
while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) {
445+
let pos = 3, result = [], match;
446+
while (match = XRegExp.exec('&lt;1>&lt;2>&lt;3>&lt;4>5&lt;6>', /&lt;(\d)>/, pos, 'sticky')) {
447447
result.push(match[1]);
448448
pos = match.index + match[0].length;
449449
}

src/xregexp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ XRegExp.escape = (str) => String(nullThrows(str)).
834834
* match.groups.hex; // -> '2620'
835835
*
836836
* // With pos and sticky, in a loop
837-
* let pos = 2, result = [], match;
837+
* let pos = 3, result = [], match;
838838
* while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) {
839839
* result.push(match[1]);
840840
* pos = match.index + match[0].length;

types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ declare namespace XRegExp {
595595
* match.groups.hex; // -> '2620'
596596
*
597597
* // With pos and sticky, in a loop
598-
* let pos = 2, result = [], match;
598+
* let pos = 3, result = [], match;
599599
* while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) {
600600
* result.push(match[1]);
601601
* pos = match.groups.index + match[0].length;

0 commit comments

Comments
 (0)