rregex 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -276
- package/jsr.json +17 -0
- package/lib/cf.d.ts +1075 -0
- package/lib/cf.mjs +20 -0
- package/lib/commonjs.cjs +996 -0
- package/lib/commonjs.d.cts +1014 -0
- package/lib/esm.d.ts +1001 -0
- package/lib/esm.mjs +990 -0
- package/lib/rregex.wasm +0 -0
- package/lib/rregex.wasm.d.ts +34 -30
- package/lib/standalone.d.ts +1067 -0
- package/lib/standalone.js +1077 -0
- package/lib/types.d.ts +554 -556
- package/lib/web.d.ts +1075 -0
- package/lib/web.js +1080 -0
- package/package.json +90 -22
- package/lib/browser.d.ts +0 -1077
- package/lib/browser.js +0 -1207
- package/lib/commonjs.d.ts +0 -1020
- package/lib/commonjs.js +0 -1152
- package/lib/module.d.ts +0 -1020
- package/lib/module.js +0 -1135
package/README.md
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
# rregex
|
|
2
2
|
|
|
3
|
-
A WebAssembly build of [Rust Regex](https://docs.rs/regex/latest/regex/) for Javascript
|
|
3
|
+
A dependency-free WebAssembly build of [Rust Regex](https://docs.rs/regex/latest/regex/) for Javascript
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
  
|
|
6
|
+
[](https://jsr.io/@rregex/rregex)
|
|
6
7
|
|
|
7
8
|
- [Why Rust Regex](#why-rust-regex)
|
|
8
9
|
- [Install](#install)
|
|
9
|
-
- [
|
|
10
|
-
|
|
11
|
-
- [`
|
|
12
|
-
- [`
|
|
13
|
-
- [`
|
|
14
|
-
- [`
|
|
15
|
-
- [`
|
|
16
|
-
|
|
17
|
-
- [`captures(text: string): Captures | undefined;`](#capturestext-string-captures--undefined) (since 1.8)
|
|
18
|
-
- [`capturesAll(text: string): Captures[];`](#capturesalltext-string-captures) (since 1.8)
|
|
19
|
-
- [`replace(text: string, rep: string): string;`](#replacetext-string-rep-string-string)
|
|
20
|
-
- [`replaceAll(text: string, rep: string): string;`](#replacealltext-string-rep-string-string)
|
|
21
|
-
- [`replacen(text: string, limit: number, rep: string): string;`](#replacentext-string-limit-number-rep-string-string)
|
|
22
|
-
- [`split(text: string): string[];`](#splittext-string-string)
|
|
23
|
-
- [`splitn(text: string, limit: number): string[];`](#splitntext-string-limit-number-string)
|
|
24
|
-
- [`shortestMatch(text: string): number | undefined;`](#shortestmatchtext-string-number--undefined)
|
|
25
|
-
- [`shortestMatchAt(text: string, limit: number): number | undefined;`](#shortestmatchattext-string-limit-number-number--undefined)
|
|
10
|
+
- [Supported Runtimes](#supported-runtimes)
|
|
11
|
+
- [API](https://tsdocs.dev/docs/rregex/latest)
|
|
12
|
+
- [`RRegex`](https://tsdocs.dev/docs/rregex/latest/classes/RRegex.html)
|
|
13
|
+
- [`RRegexSet`](https://tsdocs.dev/docs/rregex/latest/classes/RRegexSet.html)
|
|
14
|
+
- [`Match`](https://tsdocs.dev/docs/rregex/latest/types/Match.html)
|
|
15
|
+
- [`Captures`](https://tsdocs.dev/docs/rregex/latest/types/Captures.html)
|
|
16
|
+
- [`escape`](https://tsdocs.dev/docs/rregex/latest/functions/escape.html)
|
|
17
|
+
- [Benchmarks](#benchmarks)
|
|
26
18
|
- [Known Issues](#known-issues)
|
|
27
19
|
|
|
28
20
|
## Why Rust Regex
|
|
@@ -34,285 +26,75 @@ Rust has a powerful Regex library with a lot of features that don't exists en th
|
|
|
34
26
|
## Install
|
|
35
27
|
|
|
36
28
|
```bash
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
## API
|
|
41
|
-
|
|
42
|
-
Similar to the native `Regex` object you can create a new `RRegex` instance using a string.
|
|
43
|
-
|
|
44
|
-
```typescript
|
|
45
|
-
import { RRegex } from "rregex";
|
|
46
|
-
const re = new RRegex("^d{4}-d{2}-d{2}$");
|
|
47
|
-
assert.equal(re.isMatch("2014-01-01"), true);
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
> Note: It doesn't take a second parameter because fags are part of the syntax ([See Documentation](https://docs.rs/regex/latest/regex/#grouping-and-flags))
|
|
51
|
-
|
|
52
|
-
### `isMatch(text: string): boolean;`
|
|
53
|
-
|
|
54
|
-
Returns true if and only if there is a match for the regex in the string given.
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
const text = "I categorically deny having triskaidekaphobia.";
|
|
58
|
-
const re = new RRegex("\\b\\w{13}\\b");
|
|
59
|
-
expect(re.isMatch(text)).toEqual(true);
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
[See Documentation for `is_match`](https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match)
|
|
63
|
-
|
|
64
|
-
### `isMatchAt(text: string, limit: number): boolean;`
|
|
65
|
-
|
|
66
|
-
Returns the same as is_match, but starts the search at the given offset.
|
|
67
|
-
|
|
68
|
-
[See Documentation for `is_match_at`](https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at)
|
|
69
|
-
|
|
70
|
-
```typescript
|
|
71
|
-
const text = "I categorically deny having triskaidekaphobia.";
|
|
72
|
-
const re = new RRegex("\\b\\w{13}\\b");
|
|
73
|
-
expect(re.isMatchAt(text, 1)).toBe(true);
|
|
74
|
-
expect(re.isMatchAt(text, 5)).toBe(false);
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### `find(text: string): Match | undefined;`
|
|
78
|
-
|
|
79
|
-
Returns the start and end byte range of the leftmost-first match in `text`. If no match exists, then `undefined` is returned.
|
|
29
|
+
# NPM
|
|
30
|
+
npm install rregex
|
|
80
31
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const re = new RRegex("\\b\\w{13}\\b");
|
|
84
|
-
expect(re.find(text)).toEqual({
|
|
85
|
-
value: "categorically",
|
|
86
|
-
start: 2,
|
|
87
|
-
end: 15,
|
|
88
|
-
});
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
[See Documentation for `find`](https://docs.rs/regex/latest/regex/struct.Regex.html#method.find)
|
|
92
|
-
|
|
93
|
-
### `findAt(text: string): Match | undefined;`
|
|
94
|
-
|
|
95
|
-
Returns the same as find, but starts the search at the given offset.
|
|
96
|
-
|
|
97
|
-
```typescript
|
|
98
|
-
const text = "I categorically deny having triskaidekaphobia.";
|
|
99
|
-
const re = new RRegex("\\b\\w{13}\\b");
|
|
100
|
-
expect(re.findAt(text, 1)).toEqual({
|
|
101
|
-
value: "categorically",
|
|
102
|
-
start: 2,
|
|
103
|
-
end: 15,
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
expect(re.findAt(text, 5)).toEqual(undefined);
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
([See Documentation for `find_at`](https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at))
|
|
110
|
-
|
|
111
|
-
### `findAll(text: string): Match[];`
|
|
112
|
-
|
|
113
|
-
Returns an array for each successive non-overlapping match in text, returning the start and end byte indices with respect to text
|
|
114
|
-
|
|
115
|
-
```typescript
|
|
116
|
-
const text = 'Retroactively relinquishing remunerations is reprehensible.'
|
|
117
|
-
const re = new RRegex('\\b\\w{13}\\b')
|
|
118
|
-
expect(re.findAll(text)).toEqual([
|
|
119
|
-
{
|
|
120
|
-
"end": 13,
|
|
121
|
-
"start": 0,
|
|
122
|
-
"value": "Retroactively",
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"end": 27,
|
|
126
|
-
"start": 14,
|
|
127
|
-
"value": "relinquishing",
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"end": 41,
|
|
131
|
-
"start": 28,
|
|
132
|
-
"value": "remunerations",
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"end": 58,
|
|
136
|
-
"start": 45,
|
|
137
|
-
"value": "reprehensible",
|
|
138
|
-
},
|
|
139
|
-
])
|
|
140
|
-
})
|
|
141
|
-
```
|
|
32
|
+
# Yarn
|
|
33
|
+
yarn add rregex
|
|
142
34
|
|
|
143
|
-
|
|
35
|
+
# PNPM
|
|
36
|
+
pnpm add rregex
|
|
144
37
|
|
|
145
|
-
|
|
38
|
+
# Deno
|
|
39
|
+
deno add @rregex/rregex
|
|
146
40
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
Returns a list of the capture names in this regex.
|
|
150
|
-
|
|
151
|
-
[See Documentation for `capture_names`](https://docs.rs/regex/latest/regex/struct.Regex.html#method.capture_names)
|
|
152
|
-
|
|
153
|
-
### `captures(text: string): Captures | undefined;`
|
|
154
|
-
|
|
155
|
-
> Note: available since 1.8
|
|
156
|
-
|
|
157
|
-
Returns the capture groups corresponding to the leftmost-first
|
|
158
|
-
match in `text`. Capture group `0` always corresponds to the entire
|
|
159
|
-
match. If no match is found, then `undefined` is returned.
|
|
160
|
-
|
|
161
|
-
```typescript
|
|
162
|
-
const re = new Regex("'([^']+)'\\s+\\((\\d{4})\)")
|
|
163
|
-
const text = "Not my favorite movie: 'Citizen Kane' (1941)."
|
|
164
|
-
const caps = re.captures(text)
|
|
165
|
-
expect(caps.get[1].value).toBe("Citizen Kane")
|
|
166
|
-
expect(caps.get[2].value).toBe("1941")
|
|
167
|
-
expect(caps.get[0].value).toBe("'Citizen Kane' (1941)")
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### `capturesAll(text: string): Captures[];`
|
|
171
|
-
|
|
172
|
-
> Note: available since 1.8
|
|
173
|
-
|
|
174
|
-
Returns a list with all the non-overlapping capture groups matched
|
|
175
|
-
in `text`. This is operationally the same as `findAll`, except it
|
|
176
|
-
returns information about capturing group matches.
|
|
177
|
-
|
|
178
|
-
```typescript
|
|
179
|
-
const re = new Regex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\\)")
|
|
180
|
-
const text = "'Citizen Kane' (1941), 'The Wizard of Oz' (1939), 'M' (1931)."
|
|
181
|
-
for caps of re.captures_iter(text) {
|
|
182
|
-
console.log(
|
|
183
|
-
"Movie:", caps.name["title"].value, ","
|
|
184
|
-
"Released:", caps.name["year"].value
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
// Output:
|
|
188
|
-
// Movie: Citizen Kane, Released: 1941
|
|
189
|
-
// Movie: The Wizard of Oz, Released: 1939
|
|
190
|
-
// Movie: M, Released: 1931
|
|
41
|
+
# JSR
|
|
42
|
+
npx jsr add @rregex/rregex
|
|
191
43
|
```
|
|
192
44
|
|
|
193
|
-
|
|
45
|
+
## Supported Runtimes
|
|
194
46
|
|
|
195
|
-
|
|
47
|
+
This package includes builds for multiple runtimes
|
|
196
48
|
|
|
197
|
-
|
|
49
|
+
| Runtime | Import | version |
|
|
50
|
+
| ------------------ | ------------------------------------------------------- | ---------- |
|
|
51
|
+
| Node.js (esm) | `import { RRegex, RRegexSet } from 'rregex'` | `*` |
|
|
52
|
+
| Node.js (commonjs) | `const { RRegex, RRegexSet } = require('rregex')` | `*` |
|
|
53
|
+
| Deno | `import { RRegex, RRegexSet } from '@rregex/rregex'` | `>=1.10.8` |
|
|
54
|
+
| Bun | `import { RRegex, RRegexSet } from '@rregex/rregex'` | `>=1.10.8` |
|
|
55
|
+
| Cloudflare Workers | `import { RRegex, RRegexSet } from 'rregex/lib/cf.mjs'` | `>=1.10.8` |
|
|
56
|
+
| Browser | TODO | |
|
|
57
|
+
| Standalone | TODO | |
|
|
198
58
|
|
|
199
|
-
|
|
59
|
+
## Benchmarks
|
|
200
60
|
|
|
201
|
-
|
|
202
|
-
unnamed group that is always present and corresponds to the entire match.
|
|
61
|
+
In general terms `rregex` is at least 1 order of magnitud slower than the native `RegExp` object, but still have a good performance. **Unless you required some of the features that `rregex` provides, you should always consider using the native `RegExp` object**
|
|
203
62
|
|
|
204
|
-
|
|
205
|
-
length returned is guaranteed to be greater than zero.
|
|
63
|
+
> Benchmarks are executed using [test/deno.bench.mjs](./test/deno.bench.mjs), and [test/node.bench.mjs](./test/node.bench.mjs)
|
|
206
64
|
|
|
207
|
-
|
|
208
|
-
const re1 = new RRegex("(?P<y>\\d{4})-(?P<m>\\d{2})-(?P<d>\\d{2})");
|
|
209
|
-
expect(re1.capturesLength()).toEqual(4);
|
|
65
|
+
### Email
|
|
210
66
|
|
|
211
|
-
|
|
212
|
-
|
|
67
|
+
| benchmark | time (avg) | iter/s |
|
|
68
|
+
| --------- | -------------: | ------: |
|
|
69
|
+
| RegExp | 254.8 µs/iter | 3,925.0 |
|
|
70
|
+
| RRegex | 1.7 ms/iter | 589.9 |
|
|
213
71
|
|
|
214
|
-
|
|
215
|
-
expect(re3.capturesLength()).toEqual(2);
|
|
72
|
+
> summary: `RegExp` is 6.65x faster than `RRegex`
|
|
216
73
|
|
|
217
|
-
|
|
218
|
-
expect(re4.capturesLength()).toEqual(5);
|
|
74
|
+
### IP
|
|
219
75
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
76
|
+
| benchmark | time (avg) | iter/s |
|
|
77
|
+
| --------- | ------------: | --------: |
|
|
78
|
+
| RegExp | 39.1 µs/iter | 25,600.0 |
|
|
79
|
+
| RRegex | 1.4 ms/iter | 698.1 |
|
|
223
80
|
|
|
224
|
-
|
|
81
|
+
> summary: `RegExp` is 36.67x faster than `RRegex`
|
|
225
82
|
|
|
226
|
-
###
|
|
227
|
-
|
|
228
|
-
Replaces the leftmost-first match with the replacement provided.
|
|
229
|
-
|
|
230
|
-
If no match is found, then a copy of the string is returned unchanged.
|
|
231
|
-
|
|
232
|
-
Note that this function is polymorphic with respect to the replacement. In typical usage, this can just be a normal string:
|
|
233
|
-
|
|
234
|
-
```typescript
|
|
235
|
-
const re = new RRegex("[^01]+");
|
|
236
|
-
expect(re.replace("1078910", "")).toBe("1010");
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
But this is a bit cumbersome to use all the time. Instead, a simple syntax is supported that expands `$name` into the corresponding capture group. Here’s the last example, but using this expansion technique with named capture groups:
|
|
240
|
-
|
|
241
|
-
```typescript
|
|
242
|
-
const re = new RRegex("(?P<last>[^,\\s]+),\\s+(?P<first>\\S+)");
|
|
243
|
-
const result = re.replace("Springsteen, Bruce", "$first $last");
|
|
244
|
-
expect(result).toEqual("Bruce Springsteen");
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
Note that using `$2` instead of `$first` or `$1` instead of `$last` would produce the same result. To write a literal `$` use `$$`.
|
|
248
|
-
|
|
249
|
-
Sometimes the replacement string requires use of curly braces to delineate a capture group replacement and surrounding literal text. For example, if we wanted to join two words together with an underscore:
|
|
250
|
-
|
|
251
|
-
```typescript
|
|
252
|
-
const re = new RRegex("(?P<first>\\w+)\\s+(?P<second>\\w+)");
|
|
253
|
-
const result = re.replace("deep fried", "${first}_$second");
|
|
254
|
-
expect(result).toEqual("deep_fried");
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
Without the curly braces, the capture group name `first_` would be used, and since it doesn’t exist, it would be replaced with the empty string.
|
|
258
|
-
|
|
259
|
-
[See Documentation for `replace`](https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace)
|
|
260
|
-
|
|
261
|
-
### `replaceAll(text: string, rep: string): string;`
|
|
262
|
-
|
|
263
|
-
Replaces all non-overlapping matches in `text` with the replacement provided. This is the same as calling `replacen` with `limit` set to `0`.
|
|
264
|
-
|
|
265
|
-
[See the documentation for `replace_all`](https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all)
|
|
266
|
-
|
|
267
|
-
### `replacen(text: string, limit: number, rep: string): string;`
|
|
268
|
-
|
|
269
|
-
Replaces at most `limit` non-overlapping matches in `text` with the replacement provided. If `limit` is 0, then all non-overlapping matches are replaced.
|
|
270
|
-
|
|
271
|
-
[See Documentation for `replacen`](https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen)
|
|
272
|
-
|
|
273
|
-
### `split(text: string): string[];`
|
|
274
|
-
|
|
275
|
-
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.
|
|
276
|
-
|
|
277
|
-
```typescript
|
|
278
|
-
const re = new RRegex("[ \\t]+");
|
|
279
|
-
const fields = re.split("a b \t c\td e");
|
|
280
|
-
expect(fields).toEqual(["a", "b", "c", "d", "e"]);
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
[See Documentation for `split`](https://docs.rs/regex/latest/regex/struct.Regex.html#method.split)
|
|
284
|
-
|
|
285
|
-
### `splitn(text: string, limit: number): string[];`
|
|
286
|
-
|
|
287
|
-
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.
|
|
288
|
-
|
|
289
|
-
```typescript
|
|
290
|
-
const re = new RRegex("\\W+");
|
|
291
|
-
const fields = re.splitn("Hey! How are you?", 3);
|
|
292
|
-
expect(fields).toEqual(["Hey", "How", "are you?"]);
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
[See Documentation for `splitn`](https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn)
|
|
296
|
-
|
|
297
|
-
### `shortestMatch(text: string): number | undefined;`
|
|
298
|
-
|
|
299
|
-
Returns the end location of a match in the text given.
|
|
300
|
-
|
|
301
|
-
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.
|
|
302
|
-
|
|
303
|
-
```typescript
|
|
304
|
-
const text = "aaaaa";
|
|
305
|
-
const pos = new RRegex("a+");
|
|
306
|
-
expect(pos.shortestMatch(text)).toBe(1);
|
|
307
|
-
```
|
|
83
|
+
### URI
|
|
308
84
|
|
|
309
|
-
|
|
85
|
+
| benchmark | time (avg) | iter/s |
|
|
86
|
+
| --------- | -------------: | ----------: |
|
|
87
|
+
| RegExp | 422.7 ns/iter | 2,366,000.0 |
|
|
88
|
+
| RRegex | 1.5 ms/iter | 652.6 |
|
|
310
89
|
|
|
311
|
-
|
|
90
|
+
> summary: `RegExp` is 3625x faster than `RRegex`
|
|
312
91
|
|
|
313
|
-
|
|
92
|
+
| benckmarks | benckmarks |
|
|
93
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
94
|
+
| [](https://jsbenchmark.com/#eyJjYXNlcyI6W3siaWQiOiJlZl9VbGJvYThpRGNYeGM3VUl4YnMiLCJjb2RlIjoiREFUQS5tYXRjaCgnKD86KD86MjVbMC01XXwyWzAtNF1bMC05XXxbMDFdP1swLTldWzAtOV0pXFxcXC4pezN9KD86MjVbMC01XXwyWzAtNF1bMC05XXxbMDFdP1swLTldWzAtOV0pJykiLCJkZXBlbmRlbmNpZXMiOltdLCJuYW1lIjoiUmVnRXhwOiBJUCJ9LHsiaWQiOiI0QkxuZmtPd0p4ZTZhQ0NSVmpIOVUiLCJjb2RlIjoibmV3IHJyZWdleC5SUmVnZXgoXCIoPzooPzoyNVswLTVdfDJbMC00XVswLTldfFswMV0_WzAtOV1bMC05XSlcXFxcLil7M30oPzoyNVswLTVdfDJbMC00XVswLTldfFswMV0_WzAtOV1bMC05XSlcIikuZmluZChEQVRBKSIsImRlcGVuZGVuY2llcyI6W10sIm5hbWUiOiJSUmVnZXg6IElQIn1dLCJjb25maWciOnsibmFtZSI6IlJSZWdleCB2cyBOYXRpd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gZmV0Y2goJ2h0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9ucG0vcnJlZ2V4QDEuMTAuMTAvbGliL3JyZWdleC53YXNtJylcbmNvbnN0IHcgPSBhd2FpdCB3cmVzLmFycmF5QnVmZmVyKClcbnJyZWdleC5pbml0U3luYyh3KVxuXG5yZXR1cm4gZGF0YS5zbGljZSgwLCBNYXRoLmZsb29yKGRhdGEubGVuZ3RoLzUpKSJ9fQ) |
|
|
314
96
|
|
|
315
|
-
|
|
97
|
+
> **Note:** In order to compare with native regex these benchmarks follow the [`mariomka/regex-benchmark`](https://github.com/mariomka/regex-benchmark) structure
|
|
316
98
|
|
|
317
99
|
## Known Issues
|
|
318
100
|
|
package/jsr.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rregex/rregex",
|
|
3
|
+
"version": "0.0.0-development",
|
|
4
|
+
"description": "A dependency-free WebAssembly build of Rust Regex for Javascript",
|
|
5
|
+
"exports": "./lib/esm.mjs",
|
|
6
|
+
"publish": {
|
|
7
|
+
"include": [
|
|
8
|
+
"LICENSE",
|
|
9
|
+
"README.md",
|
|
10
|
+
"jsr.json",
|
|
11
|
+
"lib/rregex.wasm",
|
|
12
|
+
"lib/rregex.wasm.d.ts",
|
|
13
|
+
"lib/esm.mjs",
|
|
14
|
+
"lib/esm.d.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
}
|