rregex 1.10.12 → 1.11.0

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.
@@ -0,0 +1,1257 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Escapes all regular expression meta characters in `text`.
5
+ *
6
+ * The string returned may be safely used as a literal in a regular
7
+ * expression.
8
+ */
9
+ export function escape(text: string): string;
10
+ /**
11
+ * Represents a single match of a regex in a haystack.
12
+ *
13
+ * A `Match` contains both the start and end byte offsets of the match and the
14
+ * actual substring corresponding to the range of those byte offsets. It is
15
+ * guaranteed that `start <= end`. When `start == end`, the match is empty.
16
+ *
17
+ * Since this `Match` can only be produced by the top-level `Regex` APIs
18
+ * that only support searching UTF-8 encoded strings, the byte offsets for a
19
+ * `Match` are guaranteed to fall on valid UTF-8 codepoint boundaries. That
20
+ * is, slicing an `Uint8Array` created with a TextEncoder is guaranteed to never
21
+ * be out of range.
22
+ *
23
+ * # Numbering
24
+ *
25
+ * The byte offsets in a `Match` form a half-open interval. That is, the
26
+ * start of the range is inclusive and the end of the range is exclusive.
27
+ * For example, given a haystack `abcFOOxyz` and a match of `FOO`, its byte
28
+ * offset range starts at `3` and ends at `6`. `3` corresponds to `F` and
29
+ * `6` corresponds to `x`, which is one past the end of the match. This
30
+ * corresponds to the same kind of slicing that Rust uses.
31
+ *
32
+ * For more on why this was chosen over other schemes (aside from being
33
+ * consistent with how Rust the language works), see [this discussion] and
34
+ * [Dijkstra's note on a related topic][note].
35
+ *
36
+ * [this discussion]: https://github.com/rust-lang/regex/discussions/866
37
+ * [note]: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
38
+ *
39
+ * # Example
40
+ *
41
+ * This example shows the value of each of the methods on `Match` for a
42
+ * particular search.
43
+ *
44
+ * ```typescript
45
+ * import { RRegex } from "rregex"
46
+ *
47
+ * const re = new RRegex("\\p{Greek}+");
48
+ * const hay = "Greek: αβγδ";
49
+ * const m = re.find(hay);
50
+ * expect(m.start).toBe(7);
51
+ * expect(m.end).toBe(15);
52
+ * expect(m.value).toBe("αβγδ");
53
+ * ```
54
+ *
55
+ * @see @see https://docs.rs/regex/latest/regex/
56
+ */
57
+ export type Match = {
58
+ start: number
59
+ end: number
60
+ value: string
61
+ }
62
+
63
+ /**
64
+ * Represents the capture groups for a single match.
65
+ *
66
+ * Capture groups refer to parts of a regex enclosed in parentheses. They can
67
+ * be optionally named. The purpose of capture groups is to be able to
68
+ * reference different parts of a match based on the original pattern. For
69
+ * example, say you want to match the individual letters in a 5-letter word:
70
+ *
71
+ * ```text
72
+ * (?<first>\w)(\w)(?:\w)\w(?<last>\w)
73
+ * ```
74
+ *
75
+ * This regex has 4 capture groups:
76
+ *
77
+ * * The group at index `0` corresponds to the overall match. It is always
78
+ * present in every match and never has a name.
79
+ * * The group at index `1` with name `first` corresponding to the first
80
+ * letter.
81
+ * * The group at index `2` with no name corresponding to the second letter.
82
+ * * The group at index `3` with name `last` corresponding to the fifth and
83
+ * last letter.
84
+ *
85
+ * Notice that `(?:\w)` was not listed above as a capture group despite it
86
+ * being enclosed in parentheses. That's because `(?:pattern)` is a special
87
+ * syntax that permits grouping but *without* capturing. The reason for not
88
+ * treating it as a capture is that tracking and reporting capture groups
89
+ * requires additional state that may lead to slower searches. So using as few
90
+ * capture groups as possible can help performance. (Although the difference
91
+ * in performance of a couple of capture groups is likely immaterial.)
92
+ *
93
+ * # Example
94
+ *
95
+ * ```typescript
96
+ * import { RRegex } from "rregex"
97
+ *
98
+ * const re = new RRegex("(?<first>\\w)(\\w)(?:\\w)\\w(?<last>\\w)");
99
+ * const caps = re.captures("toady");
100
+ * expect(caps.get[0].value).toBe("toady");
101
+ * expect(caps.name["first"].value).toBe("t");
102
+ * expect(caps.get[2].value).toBe("o");
103
+ * expect(caps.name["last"].value).toBe("y");
104
+ * ```
105
+ */
106
+ export type Captures = {
107
+ get: Match[]
108
+ name: Record<string, Match>
109
+ }
110
+
111
+ /**
112
+ * A high-level intermediate representation (HIR) for a regular expression.
113
+ */
114
+ export type Hir = {
115
+ '@type': 'struct'
116
+ '@name': 'regex_syntax::hir::Hir'
117
+ kind: HirKind
118
+ }
119
+
120
+ /**
121
+ * The underlying kind of an arbitrary `Hir` expression.
122
+ *
123
+ * An `HirKind` is principally useful for doing case analysis on the type of a
124
+ * regular expression. If you're looking to build new `Hir` values, then you must
125
+ * use the smart constructors defined on `Hir`, like `Hir::repetition`, to build
126
+ * new `Hir` values. The API intentionally does not expose any way of building an
127
+ * `Hir` directly from an `HirKind`.
128
+ */
129
+ export type HirKind =
130
+ | HirKindEmptyVariant
131
+ | HirKindLiteralVariant
132
+ | HirKindClassVariant
133
+ | HirKindLookVariant
134
+ | HirKindRepetitionVariant
135
+ | HirKindCaptureVariant
136
+ | HirKindConcatVariant
137
+ | HirKindAlternationVariant
138
+
139
+ /**
140
+ * The empty regular expression, which matches everything, including the empty string.
141
+ */
142
+ export type HirKindEmptyVariant = {
143
+ '@type': 'enum'
144
+ '@name': 'regex_syntax::hir::HirKind'
145
+ '@variant': 'Empty'
146
+ }
147
+
148
+ /**
149
+ * A literal string that matches exactly these bytes.
150
+ */
151
+ export type HirKindLiteralVariant = {
152
+ '@type': 'enum'
153
+ '@name': 'regex_syntax::hir::HirKind'
154
+ '@variant': 'Literal'
155
+ '@values': [Literal]
156
+ }
157
+
158
+ /**
159
+ * A single character class that matches any of the characters in the class.
160
+ * A class can either consist of Unicode scalar values as characters, or it can
161
+ * use bytes.
162
+ *
163
+ * A class may be empty. In which case, it matches nothing.
164
+ */
165
+ export type HirKindClassVariant = {
166
+ '@type': 'enum'
167
+ '@name': 'regex_syntax::hir::HirKind'
168
+ '@variant': 'Class'
169
+ '@values': [Class]
170
+ }
171
+
172
+ /**
173
+ * A look-around assertion. A look-around match always has zero length.
174
+ */
175
+ export type HirKindLookVariant = {
176
+ '@type': 'enum'
177
+ '@name': 'regex_syntax::hir::HirKind'
178
+ '@variant': 'Look'
179
+ '@values': [Look]
180
+ }
181
+
182
+ /**
183
+ * A repetition operation applied to a sub-expression.
184
+ */
185
+ export type HirKindRepetitionVariant = {
186
+ '@type': 'enum'
187
+ '@name': 'regex_syntax::hir::HirKind'
188
+ '@variant': 'Repetition'
189
+ '@values': [Repetition]
190
+ }
191
+
192
+ /**
193
+ * A capturing group, which contains a sub-expression.
194
+ */
195
+ export type HirKindCaptureVariant = {
196
+ '@type': 'enum'
197
+ '@name': 'regex_syntax::hir::HirKind'
198
+ '@variant': 'Capture'
199
+ '@values': [Capture]
200
+ }
201
+
202
+ /**
203
+ * A concatenation of expressions.
204
+ *
205
+ * A concatenation matches only if each of its sub-expressions match one after
206
+ * the other.
207
+ *
208
+ * Concatenations are guaranteed by `Hir`'s smart constructors to always have at
209
+ * least two sub-expressions.
210
+ */
211
+ export type HirKindConcatVariant = {
212
+ '@type': 'enum'
213
+ '@name': 'regex_syntax::hir::HirKind'
214
+ '@variant': 'Concat'
215
+ '@values': [Hir[]]
216
+ }
217
+
218
+ /**
219
+ * An alternation of expressions.
220
+ *
221
+ * An alternation matches only if at least one of its sub-expressions match.
222
+ * If multiple sub-expressions match, then the leftmost is preferred.
223
+ *
224
+ * Alternations are guaranteed by `Hir`'s smart constructors to always have at
225
+ * least two sub-expressions.
226
+ */
227
+ export type HirKindAlternationVariant = {
228
+ '@type': 'enum'
229
+ '@name': 'regex_syntax::hir::HirKind'
230
+ '@variant': 'Alternation'
231
+ '@values': [Hir[]]
232
+ }
233
+
234
+ /**
235
+ * The high-level intermediate representation of a literal.
236
+ *
237
+ * A literal corresponds to 0 or more bytes that should be matched literally.
238
+ * The smart constructors defined on `Hir` will automatically concatenate adjacent
239
+ * literals into one literal, and will even automatically replace empty literals
240
+ * with `HirKind::Empty`.
241
+ */
242
+ export type Literal = {
243
+ '@type': 'struct'
244
+ '@name': 'regex_syntax::hir::Literal'
245
+ '@values': [Uint8Array]
246
+ }
247
+
248
+ /**
249
+ * The high-level intermediate representation of a character class.
250
+ *
251
+ * A character class corresponds to a set of characters. A character is either
252
+ * defined by a Unicode scalar value or a byte. Unicode characters are used by
253
+ * default, while bytes are used when Unicode mode (via the `u` flag) is disabled.
254
+ *
255
+ * A character class, regardless of its character type, is represented by a
256
+ * sequence of non-overlapping non-adjacent ranges of characters.
257
+ *
258
+ * Note that `Bytes` variant may be produced even when it exclusively matches
259
+ * valid UTF-8. This is because a `Bytes` variant represents an intention by the
260
+ * author of the regular expression to disable Unicode mode, which in turn
261
+ * impacts the semantics of case insensitive matching. For example, `(?i)k` and
262
+ * `(?i-u)k` will not match the same set of strings.
263
+ */
264
+ export type Class =
265
+ | ClassUnicodeVariant
266
+ | ClassByteVariant
267
+
268
+ /**
269
+ * A set of characters represented by Unicode scalar values.
270
+ */
271
+ export type ClassUnicodeVariant = {
272
+ '@type': 'enum'
273
+ '@name': 'regex_syntax::hir::Class'
274
+ '@variant': 'Unicode'
275
+ '@values': [ClassUnicode]
276
+ }
277
+
278
+ /**
279
+ * A set of characters represented by arbitrary bytes (one byte per character).
280
+ */
281
+ export type ClassByteVariant = {
282
+ '@type': 'enum'
283
+ '@name': 'regex_syntax::hir::Class'
284
+ '@variant': 'Bytes'
285
+ '@values': [ClassBytes]
286
+ }
287
+
288
+ /**
289
+ * A set of characters represented by Unicode scalar values.
290
+ */
291
+ export type ClassUnicode = {
292
+ '@type': 'struct'
293
+ '@name': 'regex_syntax::hir::ClassUnicode'
294
+
295
+ /** The underlying ranges as a slice. */
296
+ ranges: ClassUnicodeRange[]
297
+ }
298
+
299
+ /**
300
+ * A single range of characters represented by Unicode scalar values.
301
+ *
302
+ * The range is closed. That is, the start and end of the range are included in
303
+ * the range.
304
+ */
305
+ export type ClassUnicodeRange = {
306
+ '@type': 'struct'
307
+ '@name': 'regex_syntax::hir::ClassUnicodeRange'
308
+
309
+ /**
310
+ * Return the start of this range.
311
+ *
312
+ * The start of a range is always less than or equal to the end of the range.
313
+ */
314
+ start: string
315
+
316
+ /**
317
+ * Return the end of this range.
318
+ *
319
+ * The end of a range is always greater than or equal to the start of the range.
320
+ */
321
+ end: string
322
+
323
+ /**
324
+ * The number of codepoints in this range.
325
+ */
326
+ len: number
327
+ }
328
+
329
+ /**
330
+ * A set of characters represented by arbitrary bytes (where one byte corresponds
331
+ * to one character).
332
+ */
333
+ export type ClassBytes = {
334
+ '@type': 'struct'
335
+ '@name': 'regex_syntax::hir::ClassBytes'
336
+
337
+ /** The underlying ranges as a slice. */
338
+ ranges: ClassBytesRange[]
339
+ }
340
+
341
+ /**
342
+ * A single range of characters represented by arbitrary bytes.
343
+ *
344
+ * The range is closed. That is, the start and end of the range are included in
345
+ * the range.
346
+ */
347
+ export type ClassBytesRange = {
348
+ '@type': 'struct'
349
+ '@name': 'regex_syntax::hir::ClassBytesRange'
350
+
351
+ /**
352
+ * The start of this range.
353
+ *
354
+ * The start of a range is always less than or equal to the end of the range.
355
+ */
356
+ start: number
357
+
358
+ /**
359
+ * The end of this range.
360
+ *
361
+ * The end of a range is always greater than or equal to the start of the range.
362
+ */
363
+ end: number
364
+
365
+ /**
366
+ * The number of bytes in this range.
367
+ */
368
+ len: number
369
+ }
370
+
371
+ /**
372
+ * The high-level intermediate representation for a look-around assertion.
373
+ *
374
+ * An assertion match is always zero-length. Also called an “empty match.”
375
+ */
376
+ export type Look =
377
+ | LookStartVariant
378
+ | LookEndVariant
379
+ | LookStartLFVariant
380
+ | LookEndLFVariant
381
+ | LookStartCRLFVariant
382
+ | LookEndCRLFVariant
383
+ | LookWordAsciiVariant
384
+ | LookWordAsciiNegateVariant
385
+ | LookWordUnicodeVariant
386
+ | LookWordUnicodeNegateVariant
387
+ | LookWordStartAsciiVariant
388
+ | LookWordEndAsciiVariant
389
+ | LookWordStartUnicodeVariant
390
+ | LookWordEndUnicodeVariant
391
+ | LookWordStartHalfAsciiVariant
392
+ | LookWordEndHalfAsciiVariant
393
+ | LookWordStartHalfUnicodeVariant
394
+ | LookWordEndHalfUnicodeVariant
395
+
396
+ /**
397
+ * Match the beginning of text. Specifically, this matches at the starting
398
+ * position of the input.
399
+ */
400
+ export type LookStartVariant = {
401
+ '@type': 'enum'
402
+ '@name': 'regex_syntax::hir:Look'
403
+ '@variant': 'Start'
404
+ }
405
+
406
+ /**
407
+ * Match the end of text. Specifically, this matches at the ending position of
408
+ * the input.
409
+ */
410
+ export type LookEndVariant = {
411
+ '@type': 'enum'
412
+ '@name': 'regex_syntax::hir:Look'
413
+ '@variant': 'End'
414
+ }
415
+
416
+ /**
417
+ * Match the beginning of a line or the beginning of text. Specifically, this
418
+ * matches at the starting position of the input, or at the position immediately
419
+ * following a `\n` character.
420
+ */
421
+ export type LookStartLFVariant = {
422
+ '@type': 'enum'
423
+ '@name': 'regex_syntax::hir:Look'
424
+ '@variant': 'StartLF'
425
+ }
426
+
427
+ /**
428
+ * Match the end of a line or the end of text. Specifically, this matches at the
429
+ * end position of the input, or at the position immediately preceding a `\n`
430
+ * character.
431
+ */
432
+ export type LookEndLFVariant = {
433
+ '@type': 'enum'
434
+ '@name': 'regex_syntax::hir:Look'
435
+ '@variant': 'EndLF'
436
+ }
437
+
438
+ /**
439
+ * Match the beginning of a line or the beginning of text. Specifically, this
440
+ * matches at the starting position of the input, or at the position immediately
441
+ * following either a `\r` or `\n` character, but never after a `\r` when a `\n`
442
+ * follows.
443
+ */
444
+ export type LookStartCRLFVariant = {
445
+ '@type': 'enum'
446
+ '@name': 'regex_syntax::hir:Look'
447
+ '@variant': 'StartCRLF'
448
+ }
449
+
450
+ /**
451
+ * Match the end of a line or the end of text. Specifically, this matches at the
452
+ * end position of the input, or at the position immediately preceding a `\r` or
453
+ * `\n` character, but never before a `\n` when a `\r` precedes it.
454
+ */
455
+ export type LookEndCRLFVariant = {
456
+ '@type': 'enum'
457
+ '@name': 'regex_syntax::hir:Look'
458
+ '@variant': 'EndCRLF'
459
+ }
460
+
461
+ /**
462
+ * Match an ASCII-only word boundary. That is, this matches a position where the
463
+ * left adjacent character and right adjacent character correspond to a word and
464
+ * non-word or a non-word and word character.
465
+ */
466
+ export type LookWordAsciiVariant = {
467
+ '@type': 'enum'
468
+ '@name': 'regex_syntax::hir:Look'
469
+ '@variant': 'WordAscii'
470
+ }
471
+
472
+ /**
473
+ * Match an ASCII-only negation of a word boundary.
474
+ */
475
+ export type LookWordAsciiNegateVariant = {
476
+ '@type': 'enum'
477
+ '@name': 'regex_syntax::hir:Look'
478
+ '@variant': 'WordAsciiNegate'
479
+ }
480
+
481
+ /**
482
+ * Match a Unicode-aware word boundary. That is, this matches a position where
483
+ * the left adjacent character and right adjacent character correspond to a word
484
+ * and non-word or a non-word and word character.
485
+ */
486
+ export type LookWordUnicodeVariant = {
487
+ '@type': 'enum'
488
+ '@name': 'regex_syntax::hir:Look'
489
+ '@variant': 'WordUnicode'
490
+ }
491
+
492
+ /**
493
+ * Match a Unicode-aware negation of a word boundary.
494
+ */
495
+ export type LookWordUnicodeNegateVariant = {
496
+ '@type': 'enum'
497
+ '@name': 'regex_syntax::hir:Look'
498
+ '@variant': 'WordUnicodeNegate'
499
+ }
500
+
501
+ /**
502
+ * Match the start of an ASCII-only word boundary. That is, this matches a
503
+ * position at either the beginning of the haystack or where the previous
504
+ * character is not a word character and the following character is a word
505
+ * character.
506
+ */
507
+ export type LookWordStartAsciiVariant = {
508
+ '@type': 'enum'
509
+ '@name': 'regex_syntax::hir:Look'
510
+ '@variant': 'WordStartAscii'
511
+ }
512
+
513
+ /**
514
+ * Match the end of an ASCII-only word boundary. That is, this matches a
515
+ * position at either the end of the haystack orwhere the previous character is
516
+ * a word character and the following character is not a word character.
517
+ */
518
+ export type LookWordEndAsciiVariant = {
519
+ '@type': 'enum'
520
+ '@name': 'regex_syntax::hir:Look'
521
+ '@variant': 'WordEndAscii'
522
+ }
523
+
524
+ /**
525
+ * Match the start of a Unicode word boundary. That is, this matches a position
526
+ * at either the beginning of the haystack or where the previous character is
527
+ * not a word character and the following character is a word character.
528
+ */
529
+ export type LookWordStartUnicodeVariant = {
530
+ '@type': 'enum'
531
+ '@name': 'regex_syntax::hir:Look'
532
+ '@variant': 'WordStartUnicode'
533
+ }
534
+
535
+ /**
536
+ * Match the end of a Unicode word boundary. That is, this matches a position at
537
+ * either the end of the haystack or where the previous character is a word
538
+ * character and the following character is not a word character.
539
+ */
540
+ export type LookWordEndUnicodeVariant = {
541
+ '@type': 'enum'
542
+ '@name': 'regex_syntax::hir:Look'
543
+ '@variant': 'WordEndUnicode'
544
+ }
545
+
546
+ /**
547
+ * Match the start half of an ASCII-only word boundary. That is, this matches a
548
+ * position at either the beginning of the haystack or where the previous
549
+ * character is not a word character.
550
+ */
551
+ export type LookWordStartHalfAsciiVariant = {
552
+ '@type': 'enum'
553
+ '@name': 'regex_syntax::hir::Look',
554
+ '@variant': 'WordStartHalfAscii'
555
+ }
556
+
557
+ /**
558
+ * Match the end half of an ASCII-only word boundary. That is, this matches a
559
+ * position at either the end of the haystack or where the following character
560
+ * is not a word character.
561
+ */
562
+ export type LookWordEndHalfAsciiVariant = {
563
+ '@type': 'enum'
564
+ '@name': 'regex_syntax::hir::Look',
565
+ '@variant': 'WordEndHalfAscii'
566
+ }
567
+
568
+ /**
569
+ * Match the start half of a Unicode word boundary. That is, this matches a
570
+ * position at either the beginning of the haystack or where the previous
571
+ * character is not a word character.
572
+ */
573
+ export type LookWordStartHalfUnicodeVariant = {
574
+ '@type': 'enum'
575
+ '@name': 'regex_syntax::hir::Look',
576
+ '@variant': 'WordStartHalfUnicode'
577
+ }
578
+
579
+ /**
580
+ * Match the end half of a Unicode word boundary. That is, this matches a
581
+ * position at either the end of the haystack or where the following character
582
+ * is not a word character.
583
+ */
584
+ export type LookWordEndHalfUnicodeVariant = {
585
+ '@type': 'enum'
586
+ '@name': 'regex_syntax::hir::Look',
587
+ '@variant': 'WordEndHalfUnicode'
588
+ }
589
+
590
+ /**
591
+ * The high-level intermediate representation of a repetition operator.
592
+ *
593
+ * A repetition operator permits the repetition of an arbitrary sub-expression
594
+ */
595
+ export type Repetition = {
596
+ '@type': 'struct'
597
+ '@name': 'regex_syntax::hir::Repetition'
598
+
599
+ /**
600
+ * The minimum range of the repetition.
601
+ *
602
+ * Note that special cases like `?`, `+` and `*` all get translated into the
603
+ * ranges `{0,1}`, `{1,}` and `{0,}`, respectively.
604
+ *
605
+ * When `min` is zero, this expression can match the empty string regardless
606
+ * of what its sub-expression is.
607
+ */
608
+ min: number
609
+
610
+ /**
611
+ * The maximum range of the repetition.
612
+ *
613
+ * Note that when `max` is `undefined`, `min` acts as a lower bound but where
614
+ * there is no upper bound. For something like `x{5}` where the min and max
615
+ * are equivalent, `min` will be set to `5` and `max` will be set to `5`.
616
+ */
617
+ max?: number
618
+
619
+ /**
620
+ * Whether this repetition operator is greedy or not. A greedy operator will
621
+ * match as much as it can. A non-greedy operator will match as little as it
622
+ * can.
623
+ *
624
+ * Typically, operators are greedy by default and are only non-greedy when a
625
+ * `?` suffix is used, e.g., `(expr)*` is greedy while `(expr)*?` is not.
626
+ * However, this can be inverted via the `U` “ungreedy” flag.
627
+ */
628
+ greedy: boolean
629
+
630
+ /**
631
+ * The expression being repeated.
632
+ */
633
+ sub: Hir
634
+ }
635
+
636
+ /**
637
+ * The high-level intermediate representation for a capturing group.
638
+ *
639
+ * A capturing group always has an index and a child expression. It may also
640
+ * have a name associated with it (e.g., `(?P<foo>\w)`), but it's not necessary.
641
+ *
642
+ * Note that there is no explicit representation of a non-capturing group in a
643
+ * `Hir`. Instead, non-capturing grouping is handled automatically by the
644
+ * recursive structure of the `Hir` itself.
645
+ */
646
+ export type Capture = {
647
+ '@type': 'struct'
648
+ '@name': 'regex_syntax::hir::Capture'
649
+
650
+ /** The capture index of the capture. */
651
+ index: number
652
+
653
+ /** The name of the capture, if it exists. */
654
+ name?: String
655
+
656
+ /** The expression inside the capturing group, which may be empty. */
657
+ sub: Hir
658
+ }
659
+
660
+ /**
661
+ * A compiled regular expression for matching Unicode strings.
662
+ *
663
+ * A `RRegex` can be used to search haystacks, split haystacks into substrings
664
+ * or replace substrings in a haystack with a different substring. All
665
+ * searching is done with an implicit `(?s:.)*?` at the beginning and end of
666
+ * an pattern. To force an expression to match the whole string (or a prefix
667
+ * or a suffix), you must use an anchor like `^` or `$` (or `\A` and `\z`).
668
+ *
669
+ * While this library will handle Unicode strings (whether in the regular
670
+ * expression or in the haystack), all positions returned are **byte
671
+ * offsets**. Every byte offset is guaranteed to be at a Unicode code point
672
+ * boundary. That is, all offsets returned by the `RRegex` API are guaranteed
673
+ * to be ranges that can slice an `Uint8Array` created with a TextEncoder.
674
+ *
675
+ * # Example: slicing over UTF strings
676
+ *
677
+ * ```typescript
678
+ * import { RRegex } from "rregex"
679
+ *
680
+ * const re = new RRegex("ä")
681
+ * const m = re.find("äöü") // { start: 0, end: 2 }
682
+ *
683
+ * const buff = new TextEncoder().encode("äöü")
684
+ * const slice = buff.slice(m.start, m.end)
685
+ * expect(new TextDecoder().decode(slice)).toBe("ä")
686
+ * ```
687
+ *
688
+ * # Example: find the offsets of a US phone number:
689
+ *
690
+ * ```typescript
691
+ * import { RRegex } from "rregex"
692
+ *
693
+ * const re = new RRegex("[0-9]{3}-[0-9]{3}-[0-9]{4}");
694
+ * const m = re.find("phone: 111-222-3333");
695
+ * expect(m.start).toBe(7);
696
+ * expect(m.end).toBe(19);
697
+ * ```
698
+ *
699
+ * @see https://docs.rs/regex/latest/regex/
700
+ */
701
+ export class RRegex {
702
+ free(): void;
703
+ /**
704
+ * Compiles a regular expression. Once compiled, it can be used repeatedly
705
+ * to search, split or replace text in a string.
706
+ *
707
+ * If an invalid expression is given, then an error is returned.
708
+ */
709
+ constructor(re: string);
710
+ /**
711
+ * Returns true if and only if there is a match for the regex in the
712
+ * string given.
713
+ *
714
+ * It is recommended to use this method if all you need to do is test
715
+ * a match, since the underlying matching engine may be able to do less
716
+ * work.
717
+ *
718
+ * # Example
719
+ *
720
+ * Test if some text contains at least one word with exactly 13
721
+ * Unicode word characters:
722
+ *
723
+ * ```typescript
724
+ * import { RRegex } from "rregex"
725
+ *
726
+ * const text = "I categorically deny having triskaidekaphobia."
727
+ * expect(new RRegex("\\b\\w{13}\\b").is_match(text)).toBe(true)
728
+ * ```
729
+ *
730
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
731
+ * @param {string} text - The string against which to match the regular expression
732
+ * @return {boolean}
733
+ */
734
+ isMatch(text: string): boolean;
735
+ /**
736
+ * Returns the same as is_match, but starts the search at the given offset.
737
+ * The significance of the starting point is that it takes the surrounding
738
+ * context into consideration. For example, the `\A` anchor can only match
739
+ * when `start == 0`.
740
+ *
741
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
742
+ * @param {string} text - The string against which to match the regular expression
743
+ * @param {number} start - Zero-based index at which to start matching
744
+ * @return {boolean}
745
+ */
746
+ isMatchAt(text: string, start: number): boolean;
747
+ /**
748
+ * Returns the start and end byte range of the leftmost-first match in
749
+ * `text`. If no match exists, then `undefined` is returned.
750
+ *
751
+ * Note that this should only be used if you want to discover the position
752
+ * of the match. Testing the existence of a match is faster if you use
753
+ * `isMatch`.
754
+ *
755
+ * # Example
756
+ *
757
+ * Find the start and end location of the first word with exactly 13
758
+ * Unicode word characters:
759
+ *
760
+ * ```typescript
761
+ * import { RRegex } from "rregex"
762
+ *
763
+ * const text = "I categorically deny having triskaidekaphobia."
764
+ * const m = new RRegex("\\b\\w{13}\\b").find(text)
765
+ * expect(m.start).toBe(2)
766
+ * expect(m.end).toBe(15)
767
+ * ```
768
+ *
769
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find
770
+ * @param {string} text - The string against which to match the regular expression
771
+ * @return {Match}
772
+ */
773
+ find(text: string): Match | undefined;
774
+ /**
775
+ * Returns the same as find, but starts the search at the given
776
+ * offset.
777
+ *
778
+ * The significance of the starting point is that it takes the surrounding
779
+ * context into consideration. For example, the `\A` anchor can only
780
+ * match when `start == 0`.
781
+ *
782
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
783
+ * @param {string} text - The string against which to match the regular expression
784
+ * @param {number} start - Zero-based index at which to start matching
785
+ * @returns {Match}
786
+ */
787
+ findAt(text: string, start: number): Match | undefined;
788
+ /**
789
+ * Returns an array for each successive non-overlapping match in `text``,
790
+ * returning the start and end byte indices with respect to `text`.
791
+ *
792
+ * # Example
793
+ *
794
+ * Find the start and end location of every word with exactly 13 Unicode
795
+ * word characters:
796
+ *
797
+ * ```typescript
798
+ * import { RRegex } from "rregex"
799
+ *
800
+ * const text = "Retroactively relinquishing remunerations is reprehensible."
801
+ * const matches = new RRegex("\\b\\w{13}\\b").findAll(text)
802
+ * ```
803
+ *
804
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
805
+ * @param {string} text - The string against which to match the regular expression
806
+ * @returns {Match}
807
+ */
808
+ findAll(text: string): Match[];
809
+ /**
810
+ * Returns a list of the capture names in this regex.
811
+ *
812
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.capture_names
813
+ */
814
+ captureNames(): (string | null)[];
815
+ /**
816
+ * Returns the capture groups corresponding to the leftmost-first
817
+ * match in `text`. Capture group `0` always corresponds to the entire
818
+ * match. If no match is found, then `undefined` is returned.
819
+ *
820
+ * You should only use `captures` if you need access to the location of
821
+ * capturing group matches. Otherwise, `find` is faster for discovering
822
+ * the location of the overall match.
823
+ *
824
+ * # Examples
825
+ *
826
+ * Say you have some text with movie names and their release years,
827
+ * like "'Citizen Kane' (1941)". It'd be nice if we could search for text
828
+ * looking like that, while also extracting the movie name and its release
829
+ * year separately.
830
+ *
831
+ * ```typescript
832
+ * import { RRegex } from "rregex"
833
+ *
834
+ * const re = new RRegex("'([^']+)'\\s+\\((\\d{4})\)")
835
+ * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
836
+ * const caps = re.captures(text)
837
+ * expect(caps.get[1].value).toBe("Citizen Kane")
838
+ * expect(caps.get[2].value).toBe("1941")
839
+ * expect(caps.get[0].value).toBe("'Citizen Kane' (1941)")
840
+ * ```
841
+ *
842
+ * Note that the full match is at capture group `0`. Each subsequent
843
+ * capture group is indexed by the order of its opening `(`.
844
+ *
845
+ * We can make this example a bit clearer by using *named* capture groups:
846
+ *
847
+ * ```typescript
848
+ * import { RRegex } from "rregex"
849
+ *
850
+ * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\)")
851
+ * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
852
+ * const caps = re.captures(text)
853
+ * expect(caps.name["title"].value).toBe("Citizen Kane")
854
+ * expect(caps.name["year"].value).toBe("1941")
855
+ * expect(caps.get[0].value).toBe("'Citizen Kane' (1941)")
856
+ * ```
857
+ *
858
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures
859
+ * @param {string} text - The string against which to match the regular expression
860
+ * @returns {Captures|undefined}
861
+ */
862
+ captures(text: string): Captures | undefined;
863
+ /**
864
+ * Returns a list with all the non-overlapping capture groups matched
865
+ * in `text`. This is operationally the same as `findAll`, except it
866
+ * returns information about capturing group matches.
867
+ *
868
+ * # Example
869
+ *
870
+ * We can use this to find all movie titles and their release years in
871
+ * some text, where the movie is formatted like "'Title' (xxxx)":
872
+ *
873
+ * ```typescript
874
+ * import { RRegex } from "rregex"
875
+ *
876
+ * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\\)")
877
+ * const text = "'Citizen Kane' (1941), 'The Wizard of Oz' (1939), 'M' (1931)."
878
+ * for caps of re.captures_iter(text) {
879
+ * console.log(
880
+ * "Movie:", caps.name["title"].value, ","
881
+ * "Released:", caps.name["year"].value
882
+ * );
883
+ * }
884
+ * // Output:
885
+ * // Movie: Citizen Kane, Released: 1941
886
+ * // Movie: The Wizard of Oz, Released: 1939
887
+ * // Movie: M, Released: 1931
888
+ * ```
889
+ *
890
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures_iter
891
+ * @param {string} text - The string against which to match the regular expression
892
+ * @returns {Captures[]}
893
+ */
894
+ capturesAll(text: string): Captures[];
895
+ /**
896
+ * Returns the number of captures.
897
+ *
898
+ * This includes all named and unnamed groups, including the implicit
899
+ * unnamed group that is always present and corresponds to the entire match.
900
+ *
901
+ * Since the implicit unnamed group is always included in this length, the
902
+ * length returned is guaranteed to be greater than zero.
903
+ *
904
+ * ## Example
905
+ *
906
+ * ```typescript
907
+ * import { RRegex } from "rregex"
908
+ *
909
+ * const re1 = new RRegex("(?P<y>\\d{4})-(?P<m>\\d{2})-(?P<d>\\d{2})")
910
+ * expect(re1.capturesLength()).toEqual(4)
911
+ *
912
+ * const re2 = new RRegex("foo")
913
+ * expect(re2.capturesLength()).toEqual(1)
914
+ *
915
+ * const re3 = new RRegex("(foo)")
916
+ * expect(re3.capturesLength()).toEqual(2)
917
+ *
918
+ * const re4 = new RRegex("(?<a>.(?<b>.))(.)(?:.)(?<c>.)")
919
+ * expect(re4.capturesLength()).toEqual(5)
920
+ *
921
+ * const re5 = new RRegex("[a&&b]")
922
+ * expect(re5.capturesLength()).toEqual(1)
923
+ * ```
924
+ *
925
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures_len
926
+ */
927
+ capturesLength(): number;
928
+ /**
929
+ * Replaces the leftmost-first match with the replacement provided.
930
+ * The replacement can be a regular string (where `$N` and `$name` are
931
+ * expanded to match capture groups) or a function that takes the matches'
932
+ * `Captures` and returns the replaced string.
933
+ *
934
+ * If no match is found, then a copy of the string is returned unchanged.
935
+ *
936
+ * # Replacement string syntax
937
+ *
938
+ * All instances of `$name` in the replacement text is replaced with the
939
+ * corresponding capture group `name`.
940
+ *
941
+ * `name` may be an integer corresponding to the index of the
942
+ * capture group (counted by order of opening parenthesis where `0` is the
943
+ * entire match) or it can be a name (consisting of letters, digits or
944
+ * underscores) corresponding to a named capture group.
945
+ *
946
+ * If `name` isn't a valid capture group (whether the name doesn't exist
947
+ * or isn't a valid index), then it is replaced with the empty string.
948
+ *
949
+ * The longest possible name is used. e.g., `$1a` looks up the capture
950
+ * group named `1a` and not the capture group at index `1`. To exert more
951
+ * precise control over the name, use braces, e.g., `${1}a`.
952
+ *
953
+ * To write a literal `$` use `$$`.
954
+ *
955
+ * # Examples
956
+ *
957
+ * Note that this function is polymorphic with respect to the replacement.
958
+ * In typical usage, this can just be a normal string:
959
+ *
960
+ * ```typescript
961
+ * import { RRegex } from "rregex"
962
+ *
963
+ * const re = new RRegex("[^01]+")
964
+ * expect(re.replace("1078910", "").toBe("1010")
965
+ * ```
966
+ *
967
+ * Here's the example using this expansion technique with named capture
968
+ * groups:
969
+ *
970
+ * ```typescript
971
+ * import { RRegex } from "rregex"
972
+ *
973
+ * const re = new RRegex("(?P<last>[^,\\s]+),\\s+(?P<first>\\S+)")
974
+ * const result = re.replace("Springsteen, Bruce", "$first $last")
975
+ * expect(result).toBe("Bruce Springsteen")
976
+ * ```
977
+ *
978
+ * Note that using `$2` instead of `$first` or `$1` instead of `$last`
979
+ * would produce the same result. To write a literal `$` use `$$`.
980
+ *
981
+ * Sometimes the replacement string requires use of curly braces to
982
+ * delineate a capture group replacement and surrounding literal text.
983
+ * For example, if we wanted to join two words together with an
984
+ * underscore:
985
+ *
986
+ * ```typescript
987
+ * import { RRegex } from "rregex"
988
+ *
989
+ * const re = new RRegex("(?P<first>\\w+)\\s+(?P<second>\\w+)")
990
+ * const result = re.replace("deep fried", "${first}_$second")
991
+ * expect(result).toBe("deep_fried")
992
+ * ```
993
+ *
994
+ * Without the curly braces, the capture group name `first_` would be
995
+ * used, and since it doesn't exist, it would be replaced with the empty
996
+ * string.
997
+ *
998
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
999
+ * @param {string} text - The string against which to match the regular expression
1000
+ * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
1001
+ * @returns {string}
1002
+ */
1003
+ replace(text: string, rep: string): string;
1004
+ /**
1005
+ * Replaces at most `limit` non-overlapping matches in `text` with the
1006
+ * replacement provided. If `limit` is 0, then all non-overlapping matches
1007
+ * are replaced.
1008
+ *
1009
+ * See the documentation for `replace` for details on how to access
1010
+ * capturing group matches in the replacement string.
1011
+ *
1012
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
1013
+ * @param {string} text - The string against which to match the regular expression
1014
+ * @param {number} limit - Max number of replacement
1015
+ * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
1016
+ * @returns {string}
1017
+ */
1018
+ replacen(text: string, limit: number, rep: string): string;
1019
+ /**
1020
+ * Replaces all non-overlapping matches in `text` with the replacement
1021
+ * provided. This is the same as calling `replacen` with `limit` set to
1022
+ * `0`.
1023
+ *
1024
+ * See the documentation for `replace` for details on how to access
1025
+ * capturing group matches in the replacement string.
1026
+ *
1027
+ * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
1028
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
1029
+ * @param {string} text - The string against which to match the regular expression
1030
+ * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
1031
+ * @returns {string}
1032
+ */
1033
+ replaceAll(text: string, rep: string): string;
1034
+ /**
1035
+ * Returns an iterator of substrings of `text` delimited by a match of the
1036
+ * regular expression. Namely, each element of the iterator corresponds to
1037
+ * text that *isn't* matched by the regular expression.
1038
+ *
1039
+ * This method will *not* copy the text given.
1040
+ *
1041
+ * # Example
1042
+ *
1043
+ * To split a string delimited by arbitrary amounts of spaces or tabs:
1044
+ *
1045
+ * ```typescript
1046
+ * import { RRegex } from "rregex"
1047
+ *
1048
+ * const re = new RRegex(r"[ \\t]+")
1049
+ * const fields = re.split("a b \t c\td e")
1050
+ * expect(fields).toEqual(["a", "b", "c", "d", "e"])
1051
+ * ```
1052
+ *
1053
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.split
1054
+ * @param {string} text - The string against which to match the regular expression
1055
+ * @returns {string[]}
1056
+ */
1057
+ split(text: string): (string)[];
1058
+ /**
1059
+ * Returns an iterator of at most `limit` substrings of `text` delimited
1060
+ * by a match of the regular expression. (A `limit` of `0` will return no
1061
+ * substrings.) Namely, each element of the iterator corresponds to text
1062
+ * that *isn't* matched by the regular expression. The remainder of the
1063
+ * string that is not split will be the last element in the iterator.
1064
+ *
1065
+ * This method will *not* copy the text given.
1066
+ *
1067
+ * # Example
1068
+ *
1069
+ * Get the first two words in some text:
1070
+ *
1071
+ * ```typescript
1072
+ * import { RRegex } from "rregex"
1073
+ *
1074
+ * const re = new RRegex(r"\\W+")
1075
+ * const fields = re.splitn("Hey! How are you?", 3)
1076
+ * expect(fields).toEqual(["Hey", "How", "are you?"])
1077
+ * ```
1078
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
1079
+ * @param {string} text - The string against which to match the regular expression
1080
+ * @param {number} limit - Max number result elements
1081
+ * @returns {string[]}
1082
+ */
1083
+ splitn(text: string, limit: number): (string)[];
1084
+ /**
1085
+ * Returns the end location of a match in the text given.
1086
+ *
1087
+ * This method may have the same performance characteristics as
1088
+ * `isMatch`, except it provides an end location for a match. In
1089
+ * particular, the location returned *may be shorter* than the proper end
1090
+ * of the leftmost-first match that you would find via `Regex.find`.
1091
+ *
1092
+ * Note that it is not guaranteed that this routine finds the shortest or
1093
+ * "earliest" possible match. Instead, the main idea of this API is that
1094
+ * it returns the offset at the point at which the internal regex engine
1095
+ * has determined that a match has occurred. This may vary depending on
1096
+ * which internal regex engine is used, and thus, the offset itself may
1097
+ * change.
1098
+ *
1099
+ * # Example
1100
+ *
1101
+ * Typically, `a+` would match the entire first sequence of `a` in some
1102
+ * text, but `shortest_match` can give up as soon as it sees the first
1103
+ * `a`.
1104
+ *
1105
+ * ```typescript
1106
+ * import { RRegex } from "rregex"
1107
+ *
1108
+ * const text = "aaaaa"
1109
+ * const = new RRegex("a+").shortest_match(text)
1110
+ * expect(pos).toBe(1)
1111
+ * ```
1112
+ *
1113
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
1114
+ * @param {string} text - The string against which to match the regular expression
1115
+ * @returns {number|undefined}
1116
+ */
1117
+ shortestMatch(text: string): number | undefined;
1118
+ /**
1119
+ * Returns the same as `shortest_match`, but starts the search at the
1120
+ * given offset.
1121
+ *
1122
+ * The significance of the starting point is that it takes the surrounding
1123
+ * context into consideration. For example, the `\A` anchor can only match
1124
+ * when `start == 0`.
1125
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
1126
+ * @param {string} text - The string against which to match the regular expression
1127
+ * @param {number} start - Zero-based index at which to start matching
1128
+ * @returns {number|undefined}
1129
+ */
1130
+ shortestMatchAt(text: string, start: number): number | undefined;
1131
+ /**
1132
+ * Returns the regular expression into a high level intermediate
1133
+ * representation.
1134
+ */
1135
+ syntax(): Hir;
1136
+ /**
1137
+ * Returns a string representing the regular expression
1138
+ */
1139
+ toString(): string;
1140
+ }
1141
+ /**
1142
+ * Match multiple (possibly overlapping) regular expressions in a single scan.
1143
+ * A regex set corresponds to the union of two or more regular expressions.
1144
+ *
1145
+ * That is, a regex set will match text where at least one of its constituent
1146
+ * regular expressions matches. A regex set as its formulated here provides a
1147
+ * touch more power: it will also report which regular expressions in the set match.
1148
+ * Indeed, this is the key difference between regex sets and a single `Regex`
1149
+ * with many alternates, since only one alternate can match at a time.
1150
+ *
1151
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
1152
+ */
1153
+ export class RRegexSet {
1154
+ free(): void;
1155
+ /**
1156
+ * Create a new regex set with the given regular expressions.
1157
+ *
1158
+ * This takes an of strings, if any item in the list is not a valid regular
1159
+ * expressions, then an error is returned.
1160
+ *
1161
+ * # Example
1162
+ *
1163
+ * Create a new regex set from an iterator of strings:
1164
+ *
1165
+ * ```typescript
1166
+ * import { RegexSet } from "rregex"
1167
+ *
1168
+ * const set = new RegexSet(["\\w+", "\\d+"])
1169
+ * expect(set.is_match("foo")).toBe(true)
1170
+ * ```
1171
+ */
1172
+ constructor(list: Array<any>);
1173
+ /**
1174
+ * Returns true if and only if one of the regexes in this set matches
1175
+ * the text given.
1176
+ *
1177
+ * This method should be preferred if you only need to test whether any
1178
+ * of the regexes in the set should match, but don't care about *which*
1179
+ * regexes matched. This is because the underlying matching engine will
1180
+ * quit immediately after seeing the first match instead of continuing to
1181
+ * find all matches.
1182
+ *
1183
+ * Note that as with searches using `Regex`, the expression is unanchored
1184
+ * by default. That is, if the regex does not start with `^` or `\A`, or
1185
+ * end with `$` or `\z`, then it is permitted to match anywhere in the
1186
+ * text.
1187
+ *
1188
+ * # Example
1189
+ *
1190
+ * Tests whether a set matches some text:
1191
+ *
1192
+ * ```typescript
1193
+ * import { RegexSet } from "rregex"
1194
+ *
1195
+ * const set = new RegexSet(["\\w+", "\\d+"])
1196
+ * expect(set.is_match("foo")).toBe(true)
1197
+ * expect(!set.is_match("☃")).toBe(false)
1198
+ * ```
1199
+ *
1200
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.is_match
1201
+ * @param {string} text - The string against which to match the regular expression
1202
+ * @return {boolean}
1203
+ */
1204
+ isMatch(text: string): boolean;
1205
+ /**
1206
+ * Returns the set of regular expressions that match in the given text.
1207
+ *
1208
+ * The set returned contains the index of each regular expression that
1209
+ * matches in the given text. The index is in correspondence with the
1210
+ * order of regular expressions given to `RegexSet`'s constructor.
1211
+ *
1212
+ * The set can also be used to iterate over the matched indices.
1213
+ *
1214
+ * Note that as with searches using `Regex`, the expression is unanchored
1215
+ * by default. That is, if the regex does not start with `^` or `\A`, or
1216
+ * end with `$` or `\z`, then it is permitted to match anywhere in the
1217
+ * text.
1218
+ *
1219
+ * # Example
1220
+ *
1221
+ * Tests which regular expressions match the given text:
1222
+ *
1223
+ * ```typescript
1224
+ * import { RegexSet } from "rregex"
1225
+ *
1226
+ * const set = new RegexSet([
1227
+ * "\\w+",
1228
+ * "\\d+",
1229
+ * "\\pL+",
1230
+ * "foo",
1231
+ * "bar",
1232
+ * "barfoo",
1233
+ * "foobar",
1234
+ * ])
1235
+ * const matches = set.matches("foobar")
1236
+ * expect(matches).toBe([0, 2, 3, 4, 6])
1237
+ * ```
1238
+ *
1239
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.matches
1240
+ * @param {string} text - The string against which to match the regular expression
1241
+ * @return {number[]}
1242
+ */
1243
+ matches(text: string): number[];
1244
+ }
1245
+
1246
+ /** Build metadata */
1247
+ export const metadata: {
1248
+ "name": "rregex",
1249
+ "description": "Rust Regex binding for Javascript",
1250
+ "authors": [
1251
+ "Fede Ramirez <i@2fd.me>"
1252
+ ],
1253
+ "homepage": "http://rregex.dev",
1254
+ "repository": "https://github.com/2fd/rregex",
1255
+ "regex": "1.11.1",
1256
+ "regex-syntax": "0.8.5"
1257
+ }