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