rregex 1.0.0 → 1.0.4
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 +230 -1
- package/lib/browser.d.ts +471 -26
- package/lib/browser.js +297 -86
- package/lib/commonjs.d.ts +450 -12
- package/lib/commonjs.js +304 -88
- package/lib/module.d.ts +450 -12
- package/lib/module.js +291 -88
- package/lib/rregex.wasm +0 -0
- package/lib/rregex.wasm.d.ts +21 -14
- package/lib/types.d.ts +471 -26
- package/package.json +27 -4
package/lib/commonjs.d.ts
CHANGED
|
@@ -1,51 +1,416 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @param {string} text
|
|
5
|
+
* @returns {string}
|
|
5
6
|
*/
|
|
6
|
-
export function
|
|
7
|
+
export function escape(text: string): string;
|
|
8
|
+
|
|
9
|
+
export type Hir = {
|
|
10
|
+
'@type': 'struct'
|
|
11
|
+
'@name': 'regex_syntax::hir::Hir'
|
|
12
|
+
bold: boolean;
|
|
13
|
+
italic: boolean;
|
|
14
|
+
size: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export type HirKind =
|
|
20
|
+
| HirKindEmptyVariant
|
|
21
|
+
| HirKindLiteralVariant
|
|
22
|
+
| HirKindClassVariant
|
|
23
|
+
| HirKindAnchorVariant
|
|
24
|
+
| HirKindWordBoundaryVariant
|
|
25
|
+
| HirKindRepetitionVariant
|
|
26
|
+
| HirKindGroupVariant
|
|
27
|
+
| HirKindConcatVariant
|
|
28
|
+
| HirKindAlternationVariant
|
|
29
|
+
|
|
30
|
+
export type HirKindEmptyVariant = {
|
|
31
|
+
'@type': 'struct'
|
|
32
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
33
|
+
'@variant': 'Empty'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type HirKindLiteralVariant = {
|
|
37
|
+
'@type': 'struct'
|
|
38
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
39
|
+
'@variant': 'Literal'
|
|
40
|
+
'value': Literal
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type HirKindClassVariant = {
|
|
44
|
+
'@type': 'struct'
|
|
45
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
46
|
+
'@variant': 'Class'
|
|
47
|
+
'value': Class
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type HirKindAnchorVariant = {
|
|
51
|
+
'@type': 'struct'
|
|
52
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
53
|
+
'@variant': 'Anchor'
|
|
54
|
+
'value': Anchor
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type HirKindWordBoundaryVariant = {
|
|
58
|
+
'@type': 'struct'
|
|
59
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
60
|
+
'@variant': 'WordBoundary'
|
|
61
|
+
'value': WordBoundary
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type HirKindRepetitionVariant = {
|
|
65
|
+
'@type': 'struct'
|
|
66
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
67
|
+
'@variant': 'Repetition'
|
|
68
|
+
'value': Repetition
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type HirKindGroupVariant = {
|
|
72
|
+
'@type': 'struct'
|
|
73
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
74
|
+
'@variant': 'Group'
|
|
75
|
+
'value': Group
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type HirKindConcatVariant = {
|
|
79
|
+
'@type': 'struct'
|
|
80
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
81
|
+
'@variant': 'Concat'
|
|
82
|
+
'value': Hir[]
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type HirKindAlternationVariant = {
|
|
86
|
+
'@type': 'struct'
|
|
87
|
+
'@name': 'regex_syntax::hir::HirKind'
|
|
88
|
+
'@variant': 'Alternation'
|
|
89
|
+
'value': Hir[]
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
export type Literal =
|
|
95
|
+
| LiteralUnicodeVariant
|
|
96
|
+
| LiteralByteVariant
|
|
97
|
+
|
|
98
|
+
export type LiteralUnicodeVariant = {
|
|
99
|
+
'@type': 'struct'
|
|
100
|
+
'@name': 'regex_syntax::hir::Literal'
|
|
101
|
+
'@variant': 'Unicode'
|
|
102
|
+
'value': string
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type LiteralByteVariant = {
|
|
106
|
+
'@type': 'struct'
|
|
107
|
+
'@name': 'regex_syntax::hir::Literal'
|
|
108
|
+
'@variant': 'Byte'
|
|
109
|
+
'value': number
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
export type Class =
|
|
115
|
+
| ClassUnicodeVariant
|
|
116
|
+
| ClassByteVariant
|
|
117
|
+
|
|
118
|
+
export type ClassUnicodeVariant = {
|
|
119
|
+
'@type': 'struct'
|
|
120
|
+
'@name': 'regex_syntax::hir::Class'
|
|
121
|
+
'@variant': 'Unicode'
|
|
122
|
+
'value': ClassUnicode
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type ClassByteVariant = {
|
|
126
|
+
'@type': 'struct'
|
|
127
|
+
'@name': 'regex_syntax::hir::Class'
|
|
128
|
+
'@variant': 'Bytes'
|
|
129
|
+
'value': ClassBytes
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
export type ClassUnicode = {
|
|
135
|
+
'@type': 'struct'
|
|
136
|
+
'@name': 'regex_syntax::hir::ClassUnicode'
|
|
137
|
+
'ranges': ClassUnicodeRange[]
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
export type ClassUnicodeRange = {
|
|
143
|
+
'@type': 'struct'
|
|
144
|
+
'@name': 'regex_syntax::hir::ClassUnicodeRange'
|
|
145
|
+
start: string
|
|
146
|
+
end: string
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
export type ClassBytes = {
|
|
152
|
+
'@type': 'struct'
|
|
153
|
+
'@name': 'regex_syntax::hir::ClassBytes'
|
|
154
|
+
ranges: ClassBytesRange[]
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
export type ClassBytesRange = {
|
|
160
|
+
'@type': 'struct'
|
|
161
|
+
'@name': 'regex_syntax::hir::ClassBytesRange'
|
|
162
|
+
start: number
|
|
163
|
+
end: number
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
export type Anchor =
|
|
169
|
+
| AnchorStartLineVariant
|
|
170
|
+
| AnchorEndLineVariant
|
|
171
|
+
| AnchorStartTextVariant
|
|
172
|
+
| AnchorEndTextVariant
|
|
173
|
+
|
|
174
|
+
export type AnchorStartLineVariant = {
|
|
175
|
+
'@type': 'struct'
|
|
176
|
+
'@name': 'regex_syntax::hir::Anchor'
|
|
177
|
+
'@variant': 'StartLine'
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export type AnchorEndLineVariant = {
|
|
181
|
+
'@type': 'struct'
|
|
182
|
+
'@name': 'regex_syntax::hir::Anchor'
|
|
183
|
+
'@variant': 'EndLine'
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export type AnchorStartTextVariant = {
|
|
187
|
+
'@type': 'struct'
|
|
188
|
+
'@name': 'regex_syntax::hir::Anchor'
|
|
189
|
+
'@variant': 'StartText'
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export type AnchorEndTextVariant = {
|
|
193
|
+
'@type': 'struct'
|
|
194
|
+
'@name': 'regex_syntax::hir::Anchor'
|
|
195
|
+
'@variant': 'EndText'
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
export type WordBoundary =
|
|
201
|
+
| WordBoundaryAsciiVariant
|
|
202
|
+
| WordBoundaryAsciiNegateVariant
|
|
203
|
+
| WordBoundaryUnicodeVariant
|
|
204
|
+
| WordBoundaryUnicodeNegateVariant
|
|
205
|
+
|
|
206
|
+
export type WordBoundaryAsciiVariant = {
|
|
207
|
+
'@type': 'struct'
|
|
208
|
+
'@name': 'regex_syntax::hir::WordBoundary'
|
|
209
|
+
'@variant': 'Ascii'
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export type WordBoundaryAsciiNegateVariant = {
|
|
213
|
+
'@type': 'struct'
|
|
214
|
+
'@name': 'regex_syntax::hir::WordBoundary'
|
|
215
|
+
'@variant': 'AsciiNegate'
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export type WordBoundaryUnicodeVariant = {
|
|
219
|
+
'@type': 'struct'
|
|
220
|
+
'@name': 'regex_syntax::hir::WordBoundary'
|
|
221
|
+
'@variant': 'Unicode'
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export type WordBoundaryUnicodeNegateVariant = {
|
|
225
|
+
'@type': 'struct'
|
|
226
|
+
'@name': 'regex_syntax::hir::WordBoundary'
|
|
227
|
+
'@variant': 'UnicodeNegate'
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
export type Repetition = {
|
|
233
|
+
'@type': 'struct'
|
|
234
|
+
'@name': 'regex_syntax::hir::Repetition'
|
|
235
|
+
greedy: boolean
|
|
236
|
+
kind: RepetitionKind
|
|
237
|
+
hir: Hir
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
export type RepetitionKind =
|
|
243
|
+
| RepetitionKindZeroOrOneVariant
|
|
244
|
+
| RepetitionKindZeroOrMoreVariant
|
|
245
|
+
| RepetitionKindOneOrMoreVariant
|
|
246
|
+
| RepetitionKindRangeVariant
|
|
247
|
+
|
|
248
|
+
export type RepetitionKindZeroOrOneVariant = {
|
|
249
|
+
'@type': 'struct'
|
|
250
|
+
'@name': 'regex_syntax::hir::Repetition'
|
|
251
|
+
'@variant': 'ZeroOrOne'
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export type RepetitionKindZeroOrMoreVariant = {
|
|
255
|
+
'@type': 'struct'
|
|
256
|
+
'@name': 'regex_syntax::hir::Repetition'
|
|
257
|
+
'@variant': 'ZeroOrMore'
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export type RepetitionKindOneOrMoreVariant = {
|
|
261
|
+
'@type': 'struct'
|
|
262
|
+
'@name': 'regex_syntax::hir::Repetition'
|
|
263
|
+
'@variant': 'OneOrMore'
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export type RepetitionKindRangeVariant = {
|
|
267
|
+
'@type': 'struct'
|
|
268
|
+
'@name': 'regex_syntax::hir::Repetition'
|
|
269
|
+
'@variant': 'Range'
|
|
270
|
+
value: RepetitionRange
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
export type RepetitionRange =
|
|
276
|
+
| RepetitionRangeExactlyVariant
|
|
277
|
+
| RepetitionRangeAtLeastVariant
|
|
278
|
+
| RepetitionRangeBoundedVariant
|
|
279
|
+
|
|
280
|
+
export type RepetitionRangeExactlyVariant = {
|
|
281
|
+
'@type': 'struct'
|
|
282
|
+
'@name': 'regex_syntax::hir::RepetitionRange'
|
|
283
|
+
'@variant': 'Exactly'
|
|
284
|
+
value: number
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export type RepetitionRangeAtLeastVariant = {
|
|
288
|
+
'@type': 'struct'
|
|
289
|
+
'@name': 'regex_syntax::hir::RepetitionRange'
|
|
290
|
+
'@variant': 'AtLeast'
|
|
291
|
+
value: number
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export type RepetitionRangeBoundedVariant = {
|
|
295
|
+
'@type': 'struct'
|
|
296
|
+
'@name': 'regex_syntax::hir::RepetitionRange'
|
|
297
|
+
'@variant': 'Bounded'
|
|
298
|
+
value: [number, number]
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
export type Group = {
|
|
304
|
+
'@type': 'struct'
|
|
305
|
+
'@name': 'regex_syntax::hir::Group'
|
|
306
|
+
kind: GroupKind
|
|
307
|
+
hir: Hir
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
export type GroupKind =
|
|
313
|
+
| GroupKindCaptureIndexVariant
|
|
314
|
+
| GroupKindCaptureNameVariant
|
|
315
|
+
| GroupKindNonCapturingVariant
|
|
316
|
+
|
|
317
|
+
export type GroupKindCaptureIndexVariant = {
|
|
318
|
+
'@type': 'struct'
|
|
319
|
+
'@name': 'regex_syntax::hir::GroupKind'
|
|
320
|
+
'@variant': 'CaptureIndex'
|
|
321
|
+
index: number
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export type GroupKindCaptureNameVariant = {
|
|
325
|
+
'@type': 'struct'
|
|
326
|
+
'@name': 'regex_syntax::hir::GroupKind'
|
|
327
|
+
'@variant': 'CaptureName'
|
|
328
|
+
index: number
|
|
329
|
+
name: string
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export type GroupKindNonCapturingVariant = {
|
|
333
|
+
'@type': 'struct'
|
|
334
|
+
'@name': 'regex_syntax::hir::GroupKind'
|
|
335
|
+
'@variant': 'NonCapturing'
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
export type Match = {
|
|
341
|
+
start: number
|
|
342
|
+
end: number
|
|
343
|
+
value: string
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
|
|
7
347
|
/**
|
|
348
|
+
* A compiled regular expression for matching Unicode strings.
|
|
349
|
+
* @see https://docs.rs/regex/latest/regex/
|
|
8
350
|
*/
|
|
9
|
-
export class
|
|
351
|
+
export class RRegex {
|
|
10
352
|
free(): void;
|
|
11
353
|
/**
|
|
354
|
+
* Compiles a regular expression. Once compiled, it can be used repeatedly to search, split or replace text in a string.
|
|
355
|
+
* If an invalid expression is given, then an error is returned.
|
|
12
356
|
* @param {string} re
|
|
13
357
|
*/
|
|
14
358
|
constructor(re: string);
|
|
15
359
|
/**
|
|
360
|
+
* Returns true if and only if there is a match for the regex in the string given.
|
|
361
|
+
* 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.
|
|
362
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
|
|
16
363
|
* @param {string} text
|
|
17
364
|
* @returns {boolean}
|
|
18
365
|
*/
|
|
19
|
-
|
|
366
|
+
isMatch(text: string): boolean;
|
|
20
367
|
/**
|
|
368
|
+
* Returns the same as is_match, but starts the search at the given offset.
|
|
369
|
+
* 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`.
|
|
370
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
|
|
21
371
|
* @param {string} text
|
|
22
372
|
* @param {number} start
|
|
23
373
|
* @returns {boolean}
|
|
24
374
|
*/
|
|
25
|
-
|
|
375
|
+
isMatchAt(text: string, start: number): boolean;
|
|
26
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
|
|
27
380
|
* @param {string} text
|
|
28
381
|
* @returns {any}
|
|
29
382
|
*/
|
|
30
|
-
find(text: string):
|
|
383
|
+
find(text: string): Match | undefined;
|
|
31
384
|
/**
|
|
385
|
+
* Returns the same as find, but starts the search at the given offset.
|
|
386
|
+
* 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`.
|
|
387
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
|
|
32
388
|
* @param {string} text
|
|
33
389
|
* @param {number} start
|
|
34
390
|
* @returns {any}
|
|
35
391
|
*/
|
|
36
|
-
|
|
392
|
+
findAt(text: string, start: number): Match | undefined;
|
|
37
393
|
/**
|
|
394
|
+
* Returns an array for each successive non-overlapping match in text, returning the start and end byte indices with respect to text.
|
|
395
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
|
|
38
396
|
* @param {string} text
|
|
39
397
|
* @returns {any}
|
|
40
398
|
*/
|
|
41
|
-
|
|
399
|
+
findAll(text: string): Match[];
|
|
42
400
|
/**
|
|
401
|
+
* Replaces the leftmost-first match with the replacement provided.
|
|
402
|
+
* 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.
|
|
403
|
+
* If no match is found, then a copy of the string is returned unchanged.
|
|
404
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
|
|
43
405
|
* @param {string} text
|
|
44
406
|
* @param {string} rep
|
|
45
407
|
* @returns {string}
|
|
46
408
|
*/
|
|
47
409
|
replace(text: string, rep: string): string;
|
|
48
410
|
/**
|
|
411
|
+
* Replaces at most `limit` non-overlapping matches in `text` with the replacement provided. If `limit` is 0, then all non-overlapping matches are replaced.
|
|
412
|
+
* See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
|
|
413
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
|
|
49
414
|
* @param {string} text
|
|
50
415
|
* @param {number} limit
|
|
51
416
|
* @param {string} rep
|
|
@@ -53,24 +418,97 @@ export class RRegExp {
|
|
|
53
418
|
*/
|
|
54
419
|
replacen(text: string, limit: number, rep: string): string;
|
|
55
420
|
/**
|
|
421
|
+
* Replaces all non-overlapping matches in `text` with the replacement provided. This is the same as calling `replacen` with `limit` set to `0`.
|
|
422
|
+
* See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
|
|
423
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
|
|
56
424
|
* @param {string} text
|
|
57
425
|
* @param {string} rep
|
|
58
426
|
* @returns {string}
|
|
59
427
|
*/
|
|
60
|
-
|
|
428
|
+
replaceAll(text: string, rep: string): string;
|
|
61
429
|
/**
|
|
430
|
+
* 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.
|
|
431
|
+
* This method will not copy the text given.
|
|
432
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.split
|
|
62
433
|
* @param {string} text
|
|
63
434
|
* @returns {any}
|
|
64
435
|
*/
|
|
65
|
-
split(text: string):
|
|
436
|
+
split(text: string): string[];
|
|
66
437
|
/**
|
|
438
|
+
* 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.
|
|
439
|
+
* This method will not copy the text given.
|
|
440
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
|
|
67
441
|
* @param {string} text
|
|
68
442
|
* @param {number} limit
|
|
69
443
|
* @returns {any}
|
|
70
444
|
*/
|
|
71
|
-
splitn(text: string, limit: number):
|
|
445
|
+
splitn(text: string, limit: number): string[];
|
|
72
446
|
/**
|
|
447
|
+
* Returns the end location of a match in the text given.
|
|
448
|
+
* 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.
|
|
449
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
|
|
450
|
+
* @param {string} text
|
|
451
|
+
* @returns {number | undefined}
|
|
452
|
+
*/
|
|
453
|
+
shortestMatch(text: string): number | undefined;
|
|
454
|
+
/**
|
|
455
|
+
* Returns the same as shortest_match, but starts the search at the given offset.
|
|
456
|
+
* 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`.
|
|
457
|
+
* @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
|
|
458
|
+
* @param {string} text
|
|
459
|
+
* @param {number} limit
|
|
460
|
+
* @returns {number | undefined}
|
|
461
|
+
*/
|
|
462
|
+
shortestMatchAt(text: string, limit: number): number | undefined;
|
|
463
|
+
/**
|
|
464
|
+
* Return the Regex syntax object
|
|
73
465
|
* @returns {any}
|
|
74
466
|
*/
|
|
75
|
-
syntax():
|
|
467
|
+
syntax(): Hir;
|
|
468
|
+
/**
|
|
469
|
+
* Returns a string representing the regular expression
|
|
470
|
+
* @returns {string}
|
|
471
|
+
*/
|
|
472
|
+
toString(): string;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Match multiple (possibly overlapping) regular expressions in a single scan.
|
|
476
|
+
* 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.
|
|
477
|
+
* @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
|
|
478
|
+
*/
|
|
479
|
+
export class RRegexSet {
|
|
480
|
+
free(): void;
|
|
481
|
+
/**
|
|
482
|
+
* Create a new regex set with the given regular expressions.
|
|
483
|
+
* @param {Array<any>} list
|
|
484
|
+
*/
|
|
485
|
+
constructor(list: Array<any>);
|
|
486
|
+
/**
|
|
487
|
+
* Returns true if and only if one of the regexes in this set matches the text given.
|
|
488
|
+
* 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.
|
|
489
|
+
* @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.is_match
|
|
490
|
+
* @param {string} text
|
|
491
|
+
* @returns {boolean}
|
|
492
|
+
*/
|
|
493
|
+
isMatch(text: string): boolean;
|
|
494
|
+
/**
|
|
495
|
+
* Returns the set of regular expressions that match in the given text.
|
|
496
|
+
* 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.
|
|
497
|
+
* the set can also be used to iterate over the matched indices.
|
|
498
|
+
* @param {string} text
|
|
499
|
+
* @returns {any}
|
|
500
|
+
*/
|
|
501
|
+
matches(text: string): any;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export const metadata: {
|
|
505
|
+
"name": "rregex",
|
|
506
|
+
"description": "Rust Regex binding for Javascript",
|
|
507
|
+
"authors": [
|
|
508
|
+
"Fede Ramirez <i@2fd.me>"
|
|
509
|
+
],
|
|
510
|
+
"homepage": "https://2fd.github.io/rregex",
|
|
511
|
+
"repository": "https://github.com/2fd/rregex",
|
|
512
|
+
"regex": "1.0.6",
|
|
513
|
+
"regex-syntax": "0.6.25"
|
|
76
514
|
}
|