rregex 1.10.1 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/commonjs.js CHANGED
@@ -181,6 +181,43 @@ function handleError(f, args) {
181
181
  }
182
182
  /**
183
183
  * A compiled regular expression for matching Unicode strings.
184
+ *
185
+ * A `RRegex` can be used to search haystacks, split haystacks into substrings
186
+ * or replace substrings in a haystack with a different substring. All
187
+ * searching is done with an implicit `(?s:.)*?` at the beginning and end of
188
+ * an pattern. To force an expression to match the whole string (or a prefix
189
+ * or a suffix), you must use an anchor like `^` or `$` (or `\A` and `\z`).
190
+ *
191
+ * While this library will handle Unicode strings (whether in the regular
192
+ * expression or in the haystack), all positions returned are **byte
193
+ * offsets**. Every byte offset is guaranteed to be at a Unicode code point
194
+ * boundary. That is, all offsets returned by the `RRegex` API are guaranteed
195
+ * to be ranges that can slice an `Uint8Array` created with a TextEncoder.
196
+ *
197
+ * # Example: slicing over UTF strings
198
+ *
199
+ * ```typescript
200
+ * import { RRegex } from "rregex"
201
+ *
202
+ * const re = new RRegex("ä")
203
+ * const m = re.find("äöü") // { start: 0, end: 2 }
204
+ *
205
+ * const buff = new TextEncoder().encode("äöü")
206
+ * const slice = buff.slice(m.start, m.end)
207
+ * expect(new TextDecoder().decode(slice)).toBe("ä")
208
+ * ```
209
+ *
210
+ * # Example: find the offsets of a US phone number:
211
+ *
212
+ * ```typescript
213
+ * import { RRegex } from "rregex"
214
+ *
215
+ * const re = new RRegex("[0-9]{3}-[0-9]{3}-[0-9]{4}");
216
+ * const m = re.find("phone: 111-222-3333");
217
+ * expect(m.start).toBe(7);
218
+ * expect(m.end).toBe(19);
219
+ * ```
220
+ *
184
221
  * @see https://docs.rs/regex/latest/regex/
185
222
  */
186
223
  class RRegex {
@@ -235,6 +272,8 @@ class RRegex {
235
272
  * Unicode word characters:
236
273
  *
237
274
  * ```typescript
275
+ * import { RRegex } from "rregex"
276
+ *
238
277
  * const text = "I categorically deny having triskaidekaphobia."
239
278
  * expect(new RRegex("\\b\\w{13}\\b").is_match(text)).toBe(true)
240
279
  * ```
@@ -280,8 +319,10 @@ class RRegex {
280
319
  * Unicode word characters:
281
320
  *
282
321
  * ```typescript
322
+ * import { RRegex } from "rregex"
323
+ *
283
324
  * const text = "I categorically deny having triskaidekaphobia."
284
- * const m = new Regex("\\b\\w{13}\\b").find(text)
325
+ * const m = new RRegex("\\b\\w{13}\\b").find(text)
285
326
  * expect(m.start).toBe(2)
286
327
  * expect(m.end).toBe(15)
287
328
  * ```
@@ -347,8 +388,10 @@ class RRegex {
347
388
  * word characters:
348
389
  *
349
390
  * ```typescript
391
+ * import { RRegex } from "rregex"
392
+ *
350
393
  * const text = "Retroactively relinquishing remunerations is reprehensible."
351
- * const matches = new Regex("\\b\\w{13}\\b").findAll(text)
394
+ * const matches = new RRegex("\\b\\w{13}\\b").findAll(text)
352
395
  * ```
353
396
  *
354
397
  * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
@@ -407,7 +450,9 @@ class RRegex {
407
450
  * year separately.
408
451
  *
409
452
  * ```typescript
410
- * const re = new Regex("'([^']+)'\\s+\\((\\d{4})\)")
453
+ * import { RRegex } from "rregex"
454
+ *
455
+ * const re = new RRegex("'([^']+)'\\s+\\((\\d{4})\)")
411
456
  * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
412
457
  * const caps = re.captures(text)
413
458
  * expect(caps.get[1].value).toBe("Citizen Kane")
@@ -421,7 +466,9 @@ class RRegex {
421
466
  * We can make this example a bit clearer by using *named* capture groups:
422
467
  *
423
468
  * ```typescript
424
- * const re = new Regex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\)")
469
+ * import { RRegex } from "rregex"
470
+ *
471
+ * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\)")
425
472
  * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
426
473
  * const caps = re.captures(text)
427
474
  * expect(caps.name["title"].value).toBe("Citizen Kane")
@@ -461,7 +508,9 @@ class RRegex {
461
508
  * some text, where the movie is formatted like "'Title' (xxxx)":
462
509
  *
463
510
  * ```typescript
464
- * const re = new Regex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\\)")
511
+ * import { RRegex } from "rregex"
512
+ *
513
+ * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\\)")
465
514
  * const text = "'Citizen Kane' (1941), 'The Wizard of Oz' (1939), 'M' (1931)."
466
515
  * for caps of re.captures_iter(text) {
467
516
  * console.log(
@@ -508,6 +557,8 @@ class RRegex {
508
557
  * ## Example
509
558
  *
510
559
  * ```typescript
560
+ * import { RRegex } from "rregex"
561
+ *
511
562
  * const re1 = new RRegex("(?P<y>\\d{4})-(?P<m>\\d{2})-(?P<d>\\d{2})")
512
563
  * expect(re1.capturesLength()).toEqual(4)
513
564
  *
@@ -564,7 +615,9 @@ class RRegex {
564
615
  * In typical usage, this can just be a normal string:
565
616
  *
566
617
  * ```typescript
567
- * const re = new Regex("[^01]+")
618
+ * import { RRegex } from "rregex"
619
+ *
620
+ * const re = new RRegex("[^01]+")
568
621
  * expect(re.replace("1078910", "").toBe("1010")
569
622
  * ```
570
623
  *
@@ -572,7 +625,9 @@ class RRegex {
572
625
  * groups:
573
626
  *
574
627
  * ```typescript
575
- * const re = new Regex("(?P<last>[^,\\s]+),\\s+(?P<first>\\S+)")
628
+ * import { RRegex } from "rregex"
629
+ *
630
+ * const re = new RRegex("(?P<last>[^,\\s]+),\\s+(?P<first>\\S+)")
576
631
  * const result = re.replace("Springsteen, Bruce", "$first $last")
577
632
  * expect(result).toBe("Bruce Springsteen")
578
633
  * ```
@@ -586,7 +641,9 @@ class RRegex {
586
641
  * underscore:
587
642
  *
588
643
  * ```typescript
589
- * const re = new Regex("(?P<first>\\w+)\\s+(?P<second>\\w+)")
644
+ * import { RRegex } from "rregex"
645
+ *
646
+ * const re = new RRegex("(?P<first>\\w+)\\s+(?P<second>\\w+)")
590
647
  * const result = re.replace("deep fried", "${first}_$second")
591
648
  * expect(result).toBe("deep_fried")
592
649
  * ```
@@ -700,7 +757,9 @@ class RRegex {
700
757
  * To split a string delimited by arbitrary amounts of spaces or tabs:
701
758
  *
702
759
  * ```typescript
703
- * const re = new Regex(r"[ \\t]+")
760
+ * import { RRegex } from "rregex"
761
+ *
762
+ * const re = new RRegex(r"[ \\t]+")
704
763
  * const fields = re.split("a b \t c\td e")
705
764
  * expect(fields).toEqual(["a", "b", "c", "d", "e"])
706
765
  * ```
@@ -738,7 +797,9 @@ class RRegex {
738
797
  * Get the first two words in some text:
739
798
  *
740
799
  * ```typescript
741
- * const re = new Regex(r"\\W+")
800
+ * import { RRegex } from "rregex"
801
+ *
802
+ * const re = new RRegex(r"\\W+")
742
803
  * const fields = re.splitn("Hey! How are you?", 3)
743
804
  * expect(fields).toEqual(["Hey", "How", "are you?"])
744
805
  * ```
@@ -784,8 +845,10 @@ class RRegex {
784
845
  * `a`.
785
846
  *
786
847
  * ```typescript
848
+ * import { RRegex } from "rregex"
849
+ *
787
850
  * const text = "aaaaa"
788
- * const = new Regex("a+").shortest_match(text)
851
+ * const = new RRegex("a+").shortest_match(text)
789
852
  * expect(pos).toBe(1)
790
853
  * ```
791
854
  *
@@ -909,6 +972,8 @@ class RRegexSet {
909
972
  * Create a new regex set from an iterator of strings:
910
973
  *
911
974
  * ```typescript
975
+ * import { RegexSet } from "rregex"
976
+ *
912
977
  * const set = new RegexSet(["\\w+", "\\d+"])
913
978
  * expect(set.is_match("foo")).toBe(true)
914
979
  * ```
@@ -951,6 +1016,8 @@ class RRegexSet {
951
1016
  * Tests whether a set matches some text:
952
1017
  *
953
1018
  * ```typescript
1019
+ * import { RegexSet } from "rregex"
1020
+ *
954
1021
  * const set = new RegexSet(["\\w+", "\\d+"])
955
1022
  * expect(set.is_match("foo")).toBe(true)
956
1023
  * expect(!set.is_match("☃")).toBe(false)
@@ -985,6 +1052,8 @@ class RRegexSet {
985
1052
  * Tests which regular expressions match the given text:
986
1053
  *
987
1054
  * ```typescript
1055
+ * import { RegexSet } from "rregex"
1056
+ *
988
1057
  * const set = new RegexSet([
989
1058
  * "\\w+",
990
1059
  * "\\d+",
package/lib/module.d.ts CHANGED
@@ -11,6 +11,50 @@
11
11
  export function escape(text: string): string;
12
12
  /**
13
13
  * Represents a single match of a regex in a haystack.
14
+ *
15
+ * A `Match` contains both the start and end byte offsets of the match and the
16
+ * actual substring corresponding to the range of those byte offsets. It is
17
+ * guaranteed that `start <= end`. When `start == end`, the match is empty.
18
+ *
19
+ * Since this `Match` can only be produced by the top-level `Regex` APIs
20
+ * that only support searching UTF-8 encoded strings, the byte offsets for a
21
+ * `Match` are guaranteed to fall on valid UTF-8 codepoint boundaries. That
22
+ * is, slicing an `Uint8Array` created with a TextEncoder is guaranteed to never
23
+ * be out of range.
24
+ *
25
+ * # Numbering
26
+ *
27
+ * The byte offsets in a `Match` form a half-open interval. That is, the
28
+ * start of the range is inclusive and the end of the range is exclusive.
29
+ * For example, given a haystack `abcFOOxyz` and a match of `FOO`, its byte
30
+ * offset range starts at `3` and ends at `6`. `3` corresponds to `F` and
31
+ * `6` corresponds to `x`, which is one past the end of the match. This
32
+ * corresponds to the same kind of slicing that Rust uses.
33
+ *
34
+ * For more on why this was chosen over other schemes (aside from being
35
+ * consistent with how Rust the language works), see [this discussion] and
36
+ * [Dijkstra's note on a related topic][note].
37
+ *
38
+ * [this discussion]: https://github.com/rust-lang/regex/discussions/866
39
+ * [note]: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
40
+ *
41
+ * # Example
42
+ *
43
+ * This example shows the value of each of the methods on `Match` for a
44
+ * particular search.
45
+ *
46
+ * ```typescript
47
+ * import { RRegex } from "rregex"
48
+ *
49
+ * const re = new RRegex("\\p{Greek}+");
50
+ * const hay = "Greek: αβγδ";
51
+ * const m = re.find(hay);
52
+ * expect(m.start).toBe(7);
53
+ * expect(m.end).toBe(15);
54
+ * expect(m.value).toBe("αβγδ");
55
+ * ```
56
+ *
57
+ * @see @see https://docs.rs/regex/latest/regex/
14
58
  */
15
59
  export type Match = {
16
60
  start: number
@@ -19,14 +63,47 @@ export type Match = {
19
63
  }
20
64
 
21
65
  /**
22
- * Captures represents a group of captured strings for a single match.
66
+ * Represents the capture groups for a single match.
67
+ *
68
+ * Capture groups refer to parts of a regex enclosed in parentheses. They can
69
+ * be optionally named. The purpose of capture groups is to be able to
70
+ * reference different parts of a match based on the original pattern. For
71
+ * example, say you want to match the individual letters in a 5-letter word:
23
72
  *
24
- * The 0th capture always corresponds to the entire match. Each subsequent index
25
- * corresponds to the next capture group in the regex. If a capture group is named,
26
- * then the matched string is also available via the name property. (Note that the
27
- * 0th capture is always unnamed and so must be accessed with the get property.)
73
+ * ```text
74
+ * (?<first>\w)(\w)(?:\w)\w(?<last>\w)
75
+ * ```
28
76
  *
29
- * Positions returned from a capture group are always byte indices.
77
+ * This regex has 4 capture groups:
78
+ *
79
+ * * The group at index `0` corresponds to the overall match. It is always
80
+ * present in every match and never has a name.
81
+ * * The group at index `1` with name `first` corresponding to the first
82
+ * letter.
83
+ * * The group at index `2` with no name corresponding to the second letter.
84
+ * * The group at index `3` with name `last` corresponding to the fifth and
85
+ * last letter.
86
+ *
87
+ * Notice that `(?:\w)` was not listed above as a capture group despite it
88
+ * being enclosed in parentheses. That's because `(?:pattern)` is a special
89
+ * syntax that permits grouping but *without* capturing. The reason for not
90
+ * treating it as a capture is that tracking and reporting capture groups
91
+ * requires additional state that may lead to slower searches. So using as few
92
+ * capture groups as possible can help performance. (Although the difference
93
+ * in performance of a couple of capture groups is likely immaterial.)
94
+ *
95
+ * # Example
96
+ *
97
+ * ```typescript
98
+ * import { RRegex } from "rregex"
99
+ *
100
+ * const re = new RRegex("(?<first>\\w)(\\w)(?:\\w)\\w(?<last>\\w)");
101
+ * const caps = re.captures("toady");
102
+ * expect(caps.get[0].value).toBe("toady");
103
+ * expect(caps.name["first"].value).toBe("t");
104
+ * expect(caps.get[2].value).toBe("o");
105
+ * expect(caps.name["last"].value).toBe("y");
106
+ * ```
30
107
  */
31
108
  export type Captures = {
32
109
  get: Match[]
@@ -584,6 +661,43 @@ export type Capture = {
584
661
 
585
662
  /**
586
663
  * A compiled regular expression for matching Unicode strings.
664
+ *
665
+ * A `RRegex` can be used to search haystacks, split haystacks into substrings
666
+ * or replace substrings in a haystack with a different substring. All
667
+ * searching is done with an implicit `(?s:.)*?` at the beginning and end of
668
+ * an pattern. To force an expression to match the whole string (or a prefix
669
+ * or a suffix), you must use an anchor like `^` or `$` (or `\A` and `\z`).
670
+ *
671
+ * While this library will handle Unicode strings (whether in the regular
672
+ * expression or in the haystack), all positions returned are **byte
673
+ * offsets**. Every byte offset is guaranteed to be at a Unicode code point
674
+ * boundary. That is, all offsets returned by the `RRegex` API are guaranteed
675
+ * to be ranges that can slice an `Uint8Array` created with a TextEncoder.
676
+ *
677
+ * # Example: slicing over UTF strings
678
+ *
679
+ * ```typescript
680
+ * import { RRegex } from "rregex"
681
+ *
682
+ * const re = new RRegex("ä")
683
+ * const m = re.find("äöü") // { start: 0, end: 2 }
684
+ *
685
+ * const buff = new TextEncoder().encode("äöü")
686
+ * const slice = buff.slice(m.start, m.end)
687
+ * expect(new TextDecoder().decode(slice)).toBe("ä")
688
+ * ```
689
+ *
690
+ * # Example: find the offsets of a US phone number:
691
+ *
692
+ * ```typescript
693
+ * import { RRegex } from "rregex"
694
+ *
695
+ * const re = new RRegex("[0-9]{3}-[0-9]{3}-[0-9]{4}");
696
+ * const m = re.find("phone: 111-222-3333");
697
+ * expect(m.start).toBe(7);
698
+ * expect(m.end).toBe(19);
699
+ * ```
700
+ *
587
701
  * @see https://docs.rs/regex/latest/regex/
588
702
  */
589
703
  export class RRegex {
@@ -610,6 +724,8 @@ export class RRegex {
610
724
  * Unicode word characters:
611
725
  *
612
726
  * ```typescript
727
+ * import { RRegex } from "rregex"
728
+ *
613
729
  * const text = "I categorically deny having triskaidekaphobia."
614
730
  * expect(new RRegex("\\b\\w{13}\\b").is_match(text)).toBe(true)
615
731
  * ```
@@ -645,8 +761,10 @@ export class RRegex {
645
761
  * Unicode word characters:
646
762
  *
647
763
  * ```typescript
764
+ * import { RRegex } from "rregex"
765
+ *
648
766
  * const text = "I categorically deny having triskaidekaphobia."
649
- * const m = new Regex("\\b\\w{13}\\b").find(text)
767
+ * const m = new RRegex("\\b\\w{13}\\b").find(text)
650
768
  * expect(m.start).toBe(2)
651
769
  * expect(m.end).toBe(15)
652
770
  * ```
@@ -680,8 +798,10 @@ export class RRegex {
680
798
  * word characters:
681
799
  *
682
800
  * ```typescript
801
+ * import { RRegex } from "rregex"
802
+ *
683
803
  * const text = "Retroactively relinquishing remunerations is reprehensible."
684
- * const matches = new Regex("\\b\\w{13}\\b").findAll(text)
804
+ * const matches = new RRegex("\\b\\w{13}\\b").findAll(text)
685
805
  * ```
686
806
  *
687
807
  * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
@@ -712,7 +832,9 @@ export class RRegex {
712
832
  * year separately.
713
833
  *
714
834
  * ```typescript
715
- * const re = new Regex("'([^']+)'\\s+\\((\\d{4})\)")
835
+ * import { RRegex } from "rregex"
836
+ *
837
+ * const re = new RRegex("'([^']+)'\\s+\\((\\d{4})\)")
716
838
  * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
717
839
  * const caps = re.captures(text)
718
840
  * expect(caps.get[1].value).toBe("Citizen Kane")
@@ -726,7 +848,9 @@ export class RRegex {
726
848
  * We can make this example a bit clearer by using *named* capture groups:
727
849
  *
728
850
  * ```typescript
729
- * const re = new Regex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\)")
851
+ * import { RRegex } from "rregex"
852
+ *
853
+ * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\)")
730
854
  * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
731
855
  * const caps = re.captures(text)
732
856
  * expect(caps.name["title"].value).toBe("Citizen Kane")
@@ -750,7 +874,9 @@ export class RRegex {
750
874
  * some text, where the movie is formatted like "'Title' (xxxx)":
751
875
  *
752
876
  * ```typescript
753
- * const re = new Regex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\\)")
877
+ * import { RRegex } from "rregex"
878
+ *
879
+ * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\\)")
754
880
  * const text = "'Citizen Kane' (1941), 'The Wizard of Oz' (1939), 'M' (1931)."
755
881
  * for caps of re.captures_iter(text) {
756
882
  * console.log(
@@ -781,6 +907,8 @@ export class RRegex {
781
907
  * ## Example
782
908
  *
783
909
  * ```typescript
910
+ * import { RRegex } from "rregex"
911
+ *
784
912
  * const re1 = new RRegex("(?P<y>\\d{4})-(?P<m>\\d{2})-(?P<d>\\d{2})")
785
913
  * expect(re1.capturesLength()).toEqual(4)
786
914
  *
@@ -834,7 +962,9 @@ export class RRegex {
834
962
  * In typical usage, this can just be a normal string:
835
963
  *
836
964
  * ```typescript
837
- * const re = new Regex("[^01]+")
965
+ * import { RRegex } from "rregex"
966
+ *
967
+ * const re = new RRegex("[^01]+")
838
968
  * expect(re.replace("1078910", "").toBe("1010")
839
969
  * ```
840
970
  *
@@ -842,7 +972,9 @@ export class RRegex {
842
972
  * groups:
843
973
  *
844
974
  * ```typescript
845
- * const re = new Regex("(?P<last>[^,\\s]+),\\s+(?P<first>\\S+)")
975
+ * import { RRegex } from "rregex"
976
+ *
977
+ * const re = new RRegex("(?P<last>[^,\\s]+),\\s+(?P<first>\\S+)")
846
978
  * const result = re.replace("Springsteen, Bruce", "$first $last")
847
979
  * expect(result).toBe("Bruce Springsteen")
848
980
  * ```
@@ -856,7 +988,9 @@ export class RRegex {
856
988
  * underscore:
857
989
  *
858
990
  * ```typescript
859
- * const re = new Regex("(?P<first>\\w+)\\s+(?P<second>\\w+)")
991
+ * import { RRegex } from "rregex"
992
+ *
993
+ * const re = new RRegex("(?P<first>\\w+)\\s+(?P<second>\\w+)")
860
994
  * const result = re.replace("deep fried", "${first}_$second")
861
995
  * expect(result).toBe("deep_fried")
862
996
  * ```
@@ -913,7 +1047,9 @@ export class RRegex {
913
1047
  * To split a string delimited by arbitrary amounts of spaces or tabs:
914
1048
  *
915
1049
  * ```typescript
916
- * const re = new Regex(r"[ \\t]+")
1050
+ * import { RRegex } from "rregex"
1051
+ *
1052
+ * const re = new RRegex(r"[ \\t]+")
917
1053
  * const fields = re.split("a b \t c\td e")
918
1054
  * expect(fields).toEqual(["a", "b", "c", "d", "e"])
919
1055
  * ```
@@ -937,7 +1073,9 @@ export class RRegex {
937
1073
  * Get the first two words in some text:
938
1074
  *
939
1075
  * ```typescript
940
- * const re = new Regex(r"\\W+")
1076
+ * import { RRegex } from "rregex"
1077
+ *
1078
+ * const re = new RRegex(r"\\W+")
941
1079
  * const fields = re.splitn("Hey! How are you?", 3)
942
1080
  * expect(fields).toEqual(["Hey", "How", "are you?"])
943
1081
  * ```
@@ -969,8 +1107,10 @@ export class RRegex {
969
1107
  * `a`.
970
1108
  *
971
1109
  * ```typescript
1110
+ * import { RRegex } from "rregex"
1111
+ *
972
1112
  * const text = "aaaaa"
973
- * const = new Regex("a+").shortest_match(text)
1113
+ * const = new RRegex("a+").shortest_match(text)
974
1114
  * expect(pos).toBe(1)
975
1115
  * ```
976
1116
  *
@@ -1029,6 +1169,8 @@ export class RRegexSet {
1029
1169
  * Create a new regex set from an iterator of strings:
1030
1170
  *
1031
1171
  * ```typescript
1172
+ * import { RegexSet } from "rregex"
1173
+ *
1032
1174
  * const set = new RegexSet(["\\w+", "\\d+"])
1033
1175
  * expect(set.is_match("foo")).toBe(true)
1034
1176
  * ```
@@ -1055,6 +1197,8 @@ export class RRegexSet {
1055
1197
  * Tests whether a set matches some text:
1056
1198
  *
1057
1199
  * ```typescript
1200
+ * import { RegexSet } from "rregex"
1201
+ *
1058
1202
  * const set = new RegexSet(["\\w+", "\\d+"])
1059
1203
  * expect(set.is_match("foo")).toBe(true)
1060
1204
  * expect(!set.is_match("☃")).toBe(false)
@@ -1084,6 +1228,8 @@ export class RRegexSet {
1084
1228
  * Tests which regular expressions match the given text:
1085
1229
  *
1086
1230
  * ```typescript
1231
+ * import { RegexSet } from "rregex"
1232
+ *
1087
1233
  * const set = new RegexSet([
1088
1234
  * "\\w+",
1089
1235
  * "\\d+",