rregex 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -191
- package/jsr.json +17 -0
- package/lib/{browser.d.ts → cf.d.ts} +224 -253
- package/lib/cf.mjs +20 -0
- package/lib/commonjs.cjs +609 -0
- package/lib/{commonjs.d.ts → commonjs.d.cts} +186 -229
- package/lib/esm.d.ts +456 -0
- package/lib/esm.mjs +611 -0
- package/lib/rregex.wasm +0 -0
- package/lib/rregex.wasm.d.ts +29 -26
- package/lib/standalone.d.ts +517 -0
- package/lib/standalone.js +697 -0
- package/lib/types.d.ts +224 -253
- package/lib/web.d.ts +525 -0
- package/lib/web.js +700 -0
- package/package.json +127 -18
- package/lib/browser.js +0 -676
- package/lib/commonjs.js +0 -649
- package/lib/module.d.ts +0 -512
- package/lib/module.js +0 -628
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* @param {string} text
|
|
5
|
-
* @returns {string}
|
|
6
|
-
*/
|
|
7
3
|
export function escape(text: string): string;
|
|
8
4
|
|
|
9
5
|
export type Hir = {
|
|
@@ -14,81 +10,6 @@ export type Hir = {
|
|
|
14
10
|
|
|
15
11
|
|
|
16
12
|
|
|
17
|
-
export type HirKind =
|
|
18
|
-
| HirKindEmptyVariant
|
|
19
|
-
| HirKindLiteralVariant
|
|
20
|
-
| HirKindClassVariant
|
|
21
|
-
| HirKindAnchorVariant
|
|
22
|
-
| HirKindWordBoundaryVariant
|
|
23
|
-
| HirKindRepetitionVariant
|
|
24
|
-
| HirKindGroupVariant
|
|
25
|
-
| HirKindConcatVariant
|
|
26
|
-
| HirKindAlternationVariant
|
|
27
|
-
|
|
28
|
-
export type HirKindEmptyVariant = {
|
|
29
|
-
'@type': 'struct'
|
|
30
|
-
'@name': 'regex_syntax::hir::HirKind'
|
|
31
|
-
'@variant': 'Empty'
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type HirKindLiteralVariant = {
|
|
35
|
-
'@type': 'struct'
|
|
36
|
-
'@name': 'regex_syntax::hir::HirKind'
|
|
37
|
-
'@variant': 'Literal'
|
|
38
|
-
'value': Literal
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type HirKindClassVariant = {
|
|
42
|
-
'@type': 'struct'
|
|
43
|
-
'@name': 'regex_syntax::hir::HirKind'
|
|
44
|
-
'@variant': 'Class'
|
|
45
|
-
'value': Class
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type HirKindAnchorVariant = {
|
|
49
|
-
'@type': 'struct'
|
|
50
|
-
'@name': 'regex_syntax::hir::HirKind'
|
|
51
|
-
'@variant': 'Anchor'
|
|
52
|
-
'value': Anchor
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type HirKindWordBoundaryVariant = {
|
|
56
|
-
'@type': 'struct'
|
|
57
|
-
'@name': 'regex_syntax::hir::HirKind'
|
|
58
|
-
'@variant': 'WordBoundary'
|
|
59
|
-
'value': WordBoundary
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type HirKindRepetitionVariant = {
|
|
63
|
-
'@type': 'struct'
|
|
64
|
-
'@name': 'regex_syntax::hir::HirKind'
|
|
65
|
-
'@variant': 'Repetition'
|
|
66
|
-
'value': Repetition
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export type HirKindGroupVariant = {
|
|
70
|
-
'@type': 'struct'
|
|
71
|
-
'@name': 'regex_syntax::hir::HirKind'
|
|
72
|
-
'@variant': 'Group'
|
|
73
|
-
'value': Group
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export type HirKindConcatVariant = {
|
|
77
|
-
'@type': 'struct'
|
|
78
|
-
'@name': 'regex_syntax::hir::HirKind'
|
|
79
|
-
'@variant': 'Concat'
|
|
80
|
-
'value': Hir[]
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export type HirKindAlternationVariant = {
|
|
84
|
-
'@type': 'struct'
|
|
85
|
-
'@name': 'regex_syntax::hir::HirKind'
|
|
86
|
-
'@variant': 'Alternation'
|
|
87
|
-
'value': Hir[]
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
13
|
export type Literal =
|
|
93
14
|
| LiteralUnicodeVariant
|
|
94
15
|
| LiteralByteVariant
|
|
@@ -97,14 +18,14 @@ export type LiteralUnicodeVariant = {
|
|
|
97
18
|
'@type': 'struct'
|
|
98
19
|
'@name': 'regex_syntax::hir::Literal'
|
|
99
20
|
'@variant': 'Unicode'
|
|
100
|
-
'
|
|
21
|
+
'@values': [string]
|
|
101
22
|
}
|
|
102
23
|
|
|
103
24
|
export type LiteralByteVariant = {
|
|
104
25
|
'@type': 'struct'
|
|
105
26
|
'@name': 'regex_syntax::hir::Literal'
|
|
106
27
|
'@variant': 'Byte'
|
|
107
|
-
'
|
|
28
|
+
'@values': [number]
|
|
108
29
|
}
|
|
109
30
|
|
|
110
31
|
|
|
@@ -117,14 +38,14 @@ export type ClassUnicodeVariant = {
|
|
|
117
38
|
'@type': 'struct'
|
|
118
39
|
'@name': 'regex_syntax::hir::Class'
|
|
119
40
|
'@variant': 'Unicode'
|
|
120
|
-
'
|
|
41
|
+
'@values': [ClassUnicode]
|
|
121
42
|
}
|
|
122
43
|
|
|
123
44
|
export type ClassByteVariant = {
|
|
124
45
|
'@type': 'struct'
|
|
125
46
|
'@name': 'regex_syntax::hir::Class'
|
|
126
47
|
'@variant': 'Bytes'
|
|
127
|
-
'
|
|
48
|
+
'@values': [ClassBytes]
|
|
128
49
|
}
|
|
129
50
|
|
|
130
51
|
|
|
@@ -265,7 +186,82 @@ export type RepetitionKindRangeVariant = {
|
|
|
265
186
|
'@type': 'struct'
|
|
266
187
|
'@name': 'regex_syntax::hir::Repetition'
|
|
267
188
|
'@variant': 'Range'
|
|
268
|
-
|
|
189
|
+
'@values': [RepetitionRange]
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
export type HirKind =
|
|
195
|
+
| HirKindEmptyVariant
|
|
196
|
+
| HirKindLiteralVariant
|
|
197
|
+
| HirKindClassVariant
|
|
198
|
+
| HirKindAnchorVariant
|
|
199
|
+
| HirKindWordBoundaryVariant
|
|
200
|
+
| HirKindRepetitionVariant
|
|
201
|
+
| HirKindGroupVariant
|
|
202
|
+
| HirKindConcatVariant
|
|
203
|
+
| HirKindAlternationVariant
|
|
204
|
+
|
|
205
|
+
export type HirKindEmptyVariant = {
|
|
206
|
+
'@type': 'struct'
|
|
207
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
208
|
+
'@variant': 'Empty'
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export type HirKindLiteralVariant = {
|
|
212
|
+
'@type': 'struct'
|
|
213
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
214
|
+
'@variant': 'Literal'
|
|
215
|
+
'@values': [Literal]
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export type HirKindClassVariant = {
|
|
219
|
+
'@type': 'struct'
|
|
220
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
221
|
+
'@variant': 'Class'
|
|
222
|
+
'@values': [Class]
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export type HirKindAnchorVariant = {
|
|
226
|
+
'@type': 'struct'
|
|
227
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
228
|
+
'@variant': 'Anchor'
|
|
229
|
+
'@values': [Anchor]
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export type HirKindWordBoundaryVariant = {
|
|
233
|
+
'@type': 'struct'
|
|
234
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
235
|
+
'@variant': 'WordBoundary'
|
|
236
|
+
'@values': [WordBoundary]
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export type HirKindRepetitionVariant = {
|
|
240
|
+
'@type': 'struct'
|
|
241
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
242
|
+
'@variant': 'Repetition'
|
|
243
|
+
'@values': [Repetition]
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export type HirKindGroupVariant = {
|
|
247
|
+
'@type': 'struct'
|
|
248
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
249
|
+
'@variant': 'Group'
|
|
250
|
+
'@values': [Group]
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export type HirKindConcatVariant = {
|
|
254
|
+
'@type': 'struct'
|
|
255
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
256
|
+
'@variant': 'Concat'
|
|
257
|
+
'@values': [Hir[]]
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export type HirKindAlternationVariant = {
|
|
261
|
+
'@type': 'struct'
|
|
262
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
263
|
+
'@variant': 'Alternation'
|
|
264
|
+
'@values': [Hir[]]
|
|
269
265
|
}
|
|
270
266
|
|
|
271
267
|
|
|
@@ -279,21 +275,21 @@ export type RepetitionRangeExactlyVariant = {
|
|
|
279
275
|
'@type': 'struct'
|
|
280
276
|
'@name': 'regex_syntax::hir::RepetitionRange'
|
|
281
277
|
'@variant': 'Exactly'
|
|
282
|
-
|
|
278
|
+
'@values': [number]
|
|
283
279
|
}
|
|
284
280
|
|
|
285
281
|
export type RepetitionRangeAtLeastVariant = {
|
|
286
282
|
'@type': 'struct'
|
|
287
283
|
'@name': 'regex_syntax::hir::RepetitionRange'
|
|
288
284
|
'@variant': 'AtLeast'
|
|
289
|
-
|
|
285
|
+
'@values': [number]
|
|
290
286
|
}
|
|
291
287
|
|
|
292
288
|
export type RepetitionRangeBoundedVariant = {
|
|
293
289
|
'@type': 'struct'
|
|
294
290
|
'@name': 'regex_syntax::hir::RepetitionRange'
|
|
295
291
|
'@variant': 'Bounded'
|
|
296
|
-
|
|
292
|
+
'@values': [number, number]
|
|
297
293
|
}
|
|
298
294
|
|
|
299
295
|
|
|
@@ -343,170 +339,131 @@ export type Match = {
|
|
|
343
339
|
|
|
344
340
|
|
|
345
341
|
/**
|
|
346
|
-
* A compiled regular expression for matching Unicode strings.
|
|
347
|
-
* @see https://docs.rs/regex/latest/regex/
|
|
348
|
-
*/
|
|
342
|
+
* A compiled regular expression for matching Unicode strings.
|
|
343
|
+
* @see https://docs.rs/regex/latest/regex/
|
|
344
|
+
*/
|
|
349
345
|
export class RRegex {
|
|
350
346
|
free(): void;
|
|
351
|
-
/**
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
* @
|
|
355
|
-
*/
|
|
356
|
-
constructor(re: string);
|
|
357
|
-
/**
|
|
358
|
-
* Returns true if and only if there is a match for the regex in the string given.
|
|
359
|
-
* It is recommended to use this method if all you need to do is test a match, since the underlying matching engine may be able to do less work.
|
|
360
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
|
|
361
|
-
* @param {string} text
|
|
362
|
-
* @returns {boolean}
|
|
363
|
-
*/
|
|
364
|
-
isMatch(text: string): boolean;
|
|
365
|
-
/**
|
|
366
|
-
* Returns the same as is_match, but starts the search at the given offset.
|
|
367
|
-
* The significance of the starting point is that it takes the surrounding context into consideration. For example, the `\A` anchor can only match when `start == 0`.
|
|
368
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
|
|
369
|
-
* @param {string} text
|
|
370
|
-
* @param {number} start
|
|
371
|
-
* @returns {boolean}
|
|
372
|
-
*/
|
|
347
|
+
/**
|
|
348
|
+
* Returns the same as is_match, but starts the search at the given offset.
|
|
349
|
+
* The significance of the starting point is that it takes the surrounding context into consideration. For example, the `\A` anchor can only match when `start == 0`.
|
|
350
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
|
|
351
|
+
*/
|
|
373
352
|
isMatchAt(text: string, start: number): boolean;
|
|
374
|
-
/**
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.
|
|
378
|
-
|
|
379
|
-
* @returns {any}
|
|
380
|
-
*/
|
|
381
|
-
find(text: string): Match | undefined;
|
|
382
|
-
/**
|
|
383
|
-
* Returns the same as find, but starts the search at the given offset.
|
|
384
|
-
* The significance of the starting point is that it takes the surrounding context into consideration. For example, the \A anchor can only match when `start == 0`.
|
|
385
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
|
|
386
|
-
* @param {string} text
|
|
387
|
-
* @param {number} start
|
|
388
|
-
* @returns {any}
|
|
389
|
-
*/
|
|
390
|
-
findAt(text: string, start: number): Match | undefined;
|
|
391
|
-
/**
|
|
392
|
-
* Returns an array for each successive non-overlapping match in text, returning the start and end byte indices with respect to text.
|
|
393
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
|
|
394
|
-
* @param {string} text
|
|
395
|
-
* @returns {any}
|
|
396
|
-
*/
|
|
397
|
-
findAll(text: string): Match[];
|
|
398
|
-
/**
|
|
399
|
-
* Replaces the leftmost-first match with the replacement provided.
|
|
400
|
-
* The replacement can be a regular string (where `$N` and `$name` are expanded to match capture groups) or a function that takes the matches’ `Captures` and returns the replaced string.
|
|
401
|
-
* If no match is found, then a copy of the string is returned unchanged.
|
|
402
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
|
|
403
|
-
* @param {string} text
|
|
404
|
-
* @param {string} rep
|
|
405
|
-
* @returns {string}
|
|
406
|
-
*/
|
|
407
|
-
replace(text: string, rep: string): string;
|
|
408
|
-
/**
|
|
409
|
-
* Replaces at most `limit` non-overlapping matches in `text` with the replacement provided. If `limit` is 0, then all non-overlapping matches are replaced.
|
|
410
|
-
* See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
|
|
411
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
|
|
412
|
-
* @param {string} text
|
|
413
|
-
* @param {number} limit
|
|
414
|
-
* @param {string} rep
|
|
415
|
-
* @returns {string}
|
|
416
|
-
*/
|
|
417
|
-
replacen(text: string, limit: number, rep: string): string;
|
|
418
|
-
/**
|
|
419
|
-
* Replaces all non-overlapping matches in `text` with the replacement provided. This is the same as calling `replacen` with `limit` set to `0`.
|
|
420
|
-
* See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
|
|
421
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
|
|
422
|
-
* @param {string} text
|
|
423
|
-
* @param {string} rep
|
|
424
|
-
* @returns {string}
|
|
425
|
-
*/
|
|
353
|
+
/**
|
|
354
|
+
* Replaces all non-overlapping matches in `text` with the replacement provided. This is the same as calling `replacen` with `limit` set to `0`.
|
|
355
|
+
* See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
|
|
356
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
|
|
357
|
+
*/
|
|
426
358
|
replaceAll(text: string, rep: string): string;
|
|
427
|
-
/**
|
|
428
|
-
* Returns
|
|
429
|
-
* This method
|
|
430
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.
|
|
431
|
-
|
|
432
|
-
* @returns {any}
|
|
433
|
-
*/
|
|
434
|
-
split(text: string): string[];
|
|
435
|
-
/**
|
|
436
|
-
* Returns an iterator of at most `limit` substrings of `text` delimited by a match of the regular expression. (A limit of 0 will return no substrings.) Namely, each element of the iterator corresponds to text that isn’t matched by the regular expression. The remainder of the string that is not split will be the last element in the iterator.
|
|
437
|
-
* This method will not copy the text given.
|
|
438
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
|
|
439
|
-
* @param {string} text
|
|
440
|
-
* @param {number} limit
|
|
441
|
-
* @returns {any}
|
|
442
|
-
*/
|
|
443
|
-
splitn(text: string, limit: number): string[];
|
|
444
|
-
/**
|
|
445
|
-
* Returns the end location of a match in the text given.
|
|
446
|
-
* This method may have the same performance characteristics as `is_match`, except it provides an end location for a match. In particular, the location returned may be shorter than the proper end of the leftmost-first match.
|
|
447
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
|
|
448
|
-
* @param {string} text
|
|
449
|
-
* @returns {number | undefined}
|
|
450
|
-
*/
|
|
359
|
+
/**
|
|
360
|
+
* Returns the end location of a match in the text given.
|
|
361
|
+
* This method may have the same performance characteristics as `is_match`, except it provides an end location for a match. In particular, the location returned may be shorter than the proper end of the leftmost-first match.
|
|
362
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
|
|
363
|
+
*/
|
|
451
364
|
shortestMatch(text: string): number | undefined;
|
|
452
|
-
/**
|
|
453
|
-
* Returns the same as shortest_match, but starts the search at the given offset.
|
|
454
|
-
* The significance of the starting point is that it takes the surrounding context into consideration. For example, the \A anchor can only match when `start == 0`.
|
|
455
|
-
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
|
|
456
|
-
|
|
457
|
-
* @param {number} limit
|
|
458
|
-
* @returns {number | undefined}
|
|
459
|
-
*/
|
|
365
|
+
/**
|
|
366
|
+
* Returns the same as shortest_match, but starts the search at the given offset.
|
|
367
|
+
* The significance of the starting point is that it takes the surrounding context into consideration. For example, the \A anchor can only match when `start == 0`.
|
|
368
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
|
|
369
|
+
*/
|
|
460
370
|
shortestMatchAt(text: string, limit: number): number | undefined;
|
|
461
|
-
/**
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
*/
|
|
371
|
+
/**
|
|
372
|
+
* Compiles a regular expression. Once compiled, it can be used repeatedly to search, split or replace text in a string.
|
|
373
|
+
* If an invalid expression is given, then an error is returned.
|
|
374
|
+
*/
|
|
375
|
+
constructor(re: string);
|
|
376
|
+
/**
|
|
377
|
+
* Returns the start and end byte range of the leftmost-first match in `text`. If no match exists, then `undefined` is returned.
|
|
378
|
+
* Note that this should only be used if you want to discover the position of the match. Testing the existence of a match is faster if you use `is_match`.
|
|
379
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find
|
|
380
|
+
*/
|
|
381
|
+
find(text: string): Match | undefined;
|
|
382
|
+
/**
|
|
383
|
+
* Returns an iterator of substrings of `text` delimited by a match of the regular expression. Namely, each element of the iterator corresponds to text that isn’t matched by the regular expression.
|
|
384
|
+
* This method will not copy the text given.
|
|
385
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.split
|
|
386
|
+
*/
|
|
387
|
+
split(text: string): string[];
|
|
388
|
+
/**
|
|
389
|
+
* Returns an iterator of at most `limit` substrings of `text` delimited by a match of the regular expression. (A limit of 0 will return no substrings.) Namely, each element of the iterator corresponds to text that isn’t matched by the regular expression. The remainder of the string that is not split will be the last element in the iterator.
|
|
390
|
+
* This method will not copy the text given.
|
|
391
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
|
|
392
|
+
*/
|
|
393
|
+
splitn(text: string, limit: number): string[];
|
|
394
|
+
/**
|
|
395
|
+
* Return the Regex syntax object
|
|
396
|
+
*/
|
|
465
397
|
syntax(): Hir;
|
|
466
|
-
/**
|
|
467
|
-
* Returns
|
|
468
|
-
*
|
|
469
|
-
|
|
398
|
+
/**
|
|
399
|
+
* Returns the same as find, but starts the search at the given offset.
|
|
400
|
+
* The significance of the starting point is that it takes the surrounding context into consideration. For example, the \A anchor can only match when `start == 0`.
|
|
401
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
|
|
402
|
+
*/
|
|
403
|
+
findAt(text: string, start: number): Match | undefined;
|
|
404
|
+
/**
|
|
405
|
+
* Replaces the leftmost-first match with the replacement provided.
|
|
406
|
+
* The replacement can be a regular string (where `$N` and `$name` are expanded to match capture groups) or a function that takes the matches’ `Captures` and returns the replaced string.
|
|
407
|
+
* If no match is found, then a copy of the string is returned unchanged.
|
|
408
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
|
|
409
|
+
*/
|
|
410
|
+
replace(text: string, rep: string): string;
|
|
411
|
+
/**
|
|
412
|
+
* Returns an array for each successive non-overlapping match in text, returning the start and end byte indices with respect to text.
|
|
413
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
|
|
414
|
+
*/
|
|
415
|
+
findAll(text: string): Match[];
|
|
416
|
+
/**
|
|
417
|
+
* Returns true if and only if there is a match for the regex in the string given.
|
|
418
|
+
* It is recommended to use this method if all you need to do is test a match, since the underlying matching engine may be able to do less work.
|
|
419
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
|
|
420
|
+
*/
|
|
421
|
+
isMatch(text: string): boolean;
|
|
422
|
+
/**
|
|
423
|
+
* Replaces at most `limit` non-overlapping matches in `text` with the replacement provided. If `limit` is 0, then all non-overlapping matches are replaced.
|
|
424
|
+
* See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
|
|
425
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
|
|
426
|
+
*/
|
|
427
|
+
replacen(text: string, limit: number, rep: string): string;
|
|
428
|
+
/**
|
|
429
|
+
* Returns a string representing the regular expression
|
|
430
|
+
*/
|
|
470
431
|
toString(): string;
|
|
471
432
|
}
|
|
472
433
|
/**
|
|
473
|
-
* Match multiple (possibly overlapping) regular expressions in a single scan.
|
|
474
|
-
* A regex set corresponds to the union of two or more regular expressions. That is, a regex set will match text where at least one of its constituent regular expressions matches. A regex set as its formulated here provides a touch more power: it will also report which regular expressions in the set match. Indeed, this is the key difference between regex sets and a single `Regex` with many alternates, since only one alternate can match at a time.
|
|
475
|
-
* @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
|
|
476
|
-
*/
|
|
434
|
+
* Match multiple (possibly overlapping) regular expressions in a single scan.
|
|
435
|
+
* A regex set corresponds to the union of two or more regular expressions. That is, a regex set will match text where at least one of its constituent regular expressions matches. A regex set as its formulated here provides a touch more power: it will also report which regular expressions in the set match. Indeed, this is the key difference between regex sets and a single `Regex` with many alternates, since only one alternate can match at a time.
|
|
436
|
+
* @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
|
|
437
|
+
*/
|
|
477
438
|
export class RRegexSet {
|
|
478
439
|
free(): void;
|
|
479
|
-
/**
|
|
480
|
-
* Create a new regex set with the given regular expressions.
|
|
481
|
-
|
|
482
|
-
*/
|
|
440
|
+
/**
|
|
441
|
+
* Create a new regex set with the given regular expressions.
|
|
442
|
+
*/
|
|
483
443
|
constructor(list: Array<any>);
|
|
484
|
-
/**
|
|
485
|
-
* Returns
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
|
|
489
|
-
* @returns {boolean}
|
|
490
|
-
*/
|
|
491
|
-
isMatch(text: string): boolean;
|
|
492
|
-
/**
|
|
493
|
-
* Returns the set of regular expressions that match in the given text.
|
|
494
|
-
* The set returned contains the index of each regular expression that matches in the given text. The index is in correspondence with the order of regular expressions given to RegexSet’s constructor.
|
|
495
|
-
* the set can also be used to iterate over the matched indices.
|
|
496
|
-
* @param {string} text
|
|
497
|
-
* @returns {any}
|
|
498
|
-
*/
|
|
444
|
+
/**
|
|
445
|
+
* Returns the set of regular expressions that match in the given text.
|
|
446
|
+
* The set returned contains the index of each regular expression that matches in the given text. The index is in correspondence with the order of regular expressions given to RegexSet’s constructor.
|
|
447
|
+
* the set can also be used to iterate over the matched indices.
|
|
448
|
+
*/
|
|
499
449
|
matches(text: string): any;
|
|
450
|
+
/**
|
|
451
|
+
* Returns true if and only if one of the regexes in this set matches the text given.
|
|
452
|
+
* This method should be preferred if you only need to test whether any of the regexes in the set should match, but don’t care about which regexes matched. This is because the underlying matching engine will quit immediately after seeing the first match instead of continuing to find all matches.
|
|
453
|
+
* @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.is_match
|
|
454
|
+
*/
|
|
455
|
+
isMatch(text: string): boolean;
|
|
500
456
|
}
|
|
501
457
|
|
|
458
|
+
/** Build metadata */
|
|
502
459
|
export const metadata: {
|
|
503
460
|
"name": "rregex",
|
|
504
461
|
"description": "Rust Regex binding for Javascript",
|
|
505
462
|
"authors": [
|
|
506
463
|
"Fede Ramirez <i@2fd.me>"
|
|
507
464
|
],
|
|
508
|
-
"homepage": "
|
|
465
|
+
"homepage": "http://rregex.dev",
|
|
509
466
|
"repository": "https://github.com/2fd/rregex",
|
|
510
467
|
"regex": "1.0.6",
|
|
511
|
-
"regex-syntax": "0.6.
|
|
468
|
+
"regex-syntax": "0.6.2"
|
|
512
469
|
}
|