regexp-examples 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -5
- data/coverage/.resultset.json +203 -131
- data/coverage/coverage-badge.png +0 -0
- data/coverage/index.html +1264 -832
- data/lib/regexp-examples/constants.rb +17 -12
- data/lib/regexp-examples/groups.rb +21 -9
- data/lib/regexp-examples/helpers.rb +11 -3
- data/lib/regexp-examples/parser.rb +7 -3
- data/lib/regexp-examples/regexp_extensions.rb +3 -5
- data/lib/regexp-examples/repeaters.rb +11 -5
- data/lib/regexp-examples/version.rb +1 -1
- data/spec/regexp-examples_spec.rb +28 -2
- data/spec/spec_helper.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97f98bdeee2363a4103134a035ccac28f1e6a295
|
4
|
+
data.tar.gz: 2287c4ba5ab2503b11d365a8c63d37bef36fedb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 461ae18a43b65a36cb04c6f5036c2a63ae8ea159820eb9bb02b7267b9b7718b474e6eae480afae8f9f89fb9c0231399c8388ac12179f603288810aa6c112a2a5
|
7
|
+
data.tar.gz: 883b05b33bfec6f6a30ca6534fe86fed248f9f24b9a6c1c87f2e797f8a98dbda02fb66db673bc9c889f7938003ae03a2e0ec58d5e92a34af83f82f4ae4b4c9c6
|
data/README.md
CHANGED
@@ -14,11 +14,8 @@ or a huge number of possible matches, such as `/.\w/`, then only a subset of the
|
|
14
14
|
|
15
15
|
```ruby
|
16
16
|
/a*/.examples #=> [''. 'a', 'aa']
|
17
|
-
/
|
17
|
+
/ab+/.examples #=> ['ab', 'abb', 'abbb']
|
18
18
|
/this|is|awesome/.examples #=> ['this', 'is', 'awesome']
|
19
|
-
/foo-.{1,}-bar/.examples #=> ['foo-a-bar', 'foo-b-bar', 'foo-c-bar', 'foo-d-bar', 'foo-e-bar',
|
20
|
-
# 'foo-aa-bar', 'foo-bb-bar', 'foo-cc-bar', 'foo-dd-bar', 'foo-ee-bar', 'foo-aaa-bar', 'foo-bbb-bar',
|
21
|
-
# 'foo-ccc-bar', 'foo-ddd-bar', 'foo-eee-bar']
|
22
19
|
/https?:\/\/(www\.)?github\.com/.examples #=> ['http://github.com',
|
23
20
|
# 'http://www.github.com', 'https://github.com', 'https://www.github.com']
|
24
21
|
/(I(N(C(E(P(T(I(O(N)))))))))*/.examples #=> ["", "INCEPTION", "INCEPTIONINCEPTION"]
|
@@ -29,7 +26,7 @@ or a huge number of possible matches, such as `/.\w/`, then only a subset of the
|
|
29
26
|
|
30
27
|
## Supported syntax
|
31
28
|
|
32
|
-
* All forms of repeaters (quantifiers), e.g. `/a*/`, `/a+/`, `/a?/`, `/a{1,4}/`, `/a{3,}/`,
|
29
|
+
* All forms of repeaters (quantifiers), e.g. `/a*/`, `/a+/`, `/a?/`, `/a{1,4}/`, `/a{3,}/`, `/a{,2}/`
|
33
30
|
* Boolean "Or" groups, e.g. `/a|b|c/`
|
34
31
|
* Character sets (inluding ranges and negation!), e.g. `/[abc]/`, `/[A-Z0-9]/`, `/[^a-z]/`, `/[\w\s\b]/`
|
35
32
|
* Escaped characters, e.g. `/\n/`, `/\w/`, `/\D/` (and so on...)
|
@@ -66,6 +63,16 @@ Using any of the following will raise a RegexpExamples::IllegalSyntax exception:
|
|
66
63
|
|
67
64
|
(Note: Backreferences are not really "regular" either, but I got these to work with a bit of hackery!)
|
68
65
|
|
66
|
+
## Known Bugs
|
67
|
+
|
68
|
+
There are a few obscure bugs that have yet to be resolved:
|
69
|
+
|
70
|
+
* Various (weird!) legal patterns do not get parsed correctly, such as `/[[wtf]]/.examples` - To solve this, I'll probably have to dig deep into the Ruby source code and imitate the actual Regex parser more closely.
|
71
|
+
|
72
|
+
* Not all examples are shown for repeated groups, e.g. `/[ab]{2}/.examples` does not contain `"ab"` or `"ba"`. This is due to a flaw in the current parser design, and will be fixed in the next major release.
|
73
|
+
|
74
|
+
* Similarly, examples like `/(a){2} \1/.examples #=> ["aa aa"]` do not quite work properly, as the backreference is saved as `"aa"`, rather than just `"a"`. This bug is closely related to the one above.
|
75
|
+
|
69
76
|
## Installation
|
70
77
|
|
71
78
|
Add this line to your application's Gemfile:
|
data/coverage/.resultset.json
CHANGED
@@ -16,19 +16,27 @@
|
|
16
16
|
null,
|
17
17
|
null,
|
18
18
|
1,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
353,
|
20
|
+
353,
|
21
|
+
205,
|
22
|
+
295,
|
23
|
+
null,
|
24
|
+
null,
|
25
|
+
null,
|
26
|
+
1,
|
27
|
+
295,
|
28
|
+
295,
|
29
|
+
null,
|
23
30
|
null,
|
31
|
+
295,
|
24
32
|
null,
|
25
33
|
null,
|
26
34
|
1,
|
27
|
-
264,
|
28
|
-
264,
|
29
35
|
null,
|
36
|
+
208,
|
37
|
+
107,
|
38
|
+
107,
|
30
39
|
null,
|
31
|
-
264,
|
32
40
|
null,
|
33
41
|
null,
|
34
42
|
null
|
@@ -38,48 +46,48 @@
|
|
38
46
|
1,
|
39
47
|
1,
|
40
48
|
1,
|
41
|
-
|
49
|
+
394,
|
42
50
|
null,
|
43
51
|
null,
|
44
52
|
1,
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
53
|
+
353,
|
54
|
+
353,
|
55
|
+
353,
|
56
|
+
391,
|
57
|
+
499,
|
50
58
|
null,
|
51
59
|
null,
|
52
|
-
|
60
|
+
353,
|
53
61
|
null,
|
54
62
|
null,
|
55
63
|
null,
|
56
64
|
1,
|
57
65
|
1,
|
58
|
-
|
66
|
+
366,
|
59
67
|
null,
|
60
68
|
null,
|
61
69
|
1,
|
62
|
-
|
70
|
+
325,
|
63
71
|
null,
|
64
72
|
null,
|
65
73
|
null,
|
66
74
|
1,
|
67
75
|
1,
|
68
|
-
|
76
|
+
6,
|
69
77
|
null,
|
70
78
|
null,
|
71
79
|
1,
|
72
|
-
|
80
|
+
6,
|
73
81
|
null,
|
74
82
|
null,
|
75
83
|
null,
|
76
84
|
1,
|
77
85
|
1,
|
78
|
-
|
86
|
+
5,
|
79
87
|
null,
|
80
88
|
null,
|
81
89
|
1,
|
82
|
-
|
90
|
+
5,
|
83
91
|
null,
|
84
92
|
null,
|
85
93
|
null,
|
@@ -95,19 +103,25 @@
|
|
95
103
|
null,
|
96
104
|
1,
|
97
105
|
1,
|
98
|
-
|
99
|
-
|
100
|
-
|
106
|
+
6,
|
107
|
+
6,
|
108
|
+
6,
|
109
|
+
null,
|
101
110
|
2,
|
102
|
-
|
111
|
+
4,
|
103
112
|
1,
|
104
113
|
null,
|
105
|
-
|
114
|
+
3,
|
106
115
|
null,
|
107
116
|
null,
|
108
117
|
null,
|
109
118
|
1,
|
110
|
-
|
119
|
+
6,
|
120
|
+
null,
|
121
|
+
null,
|
122
|
+
1,
|
123
|
+
1,
|
124
|
+
2,
|
111
125
|
null,
|
112
126
|
null,
|
113
127
|
null,
|
@@ -117,11 +131,11 @@
|
|
117
131
|
1,
|
118
132
|
1,
|
119
133
|
1,
|
120
|
-
|
121
|
-
|
134
|
+
89,
|
135
|
+
183,
|
122
136
|
28,
|
123
137
|
null,
|
124
|
-
|
138
|
+
183,
|
125
139
|
null,
|
126
140
|
null,
|
127
141
|
null,
|
@@ -146,6 +160,12 @@
|
|
146
160
|
"/home/tom/git/regexp-examples/lib/regexp-examples/constants.rb": [
|
147
161
|
1,
|
148
162
|
null,
|
163
|
+
null,
|
164
|
+
null,
|
165
|
+
null,
|
166
|
+
null,
|
167
|
+
null,
|
168
|
+
null,
|
149
169
|
1,
|
150
170
|
null,
|
151
171
|
null,
|
@@ -158,9 +178,8 @@
|
|
158
178
|
1,
|
159
179
|
1,
|
160
180
|
1,
|
161
|
-
|
162
|
-
|
163
|
-
39,
|
181
|
+
37,
|
182
|
+
1,
|
164
183
|
1,
|
165
184
|
1,
|
166
185
|
null,
|
@@ -192,38 +211,40 @@
|
|
192
211
|
1,
|
193
212
|
1,
|
194
213
|
1,
|
195
|
-
|
196
|
-
|
197
|
-
|
214
|
+
106,
|
215
|
+
106,
|
216
|
+
106,
|
198
217
|
null,
|
199
218
|
null,
|
200
219
|
1,
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
361,
|
220
|
+
157,
|
221
|
+
157,
|
222
|
+
453,
|
223
|
+
435,
|
224
|
+
394,
|
225
|
+
9,
|
208
226
|
null,
|
209
|
-
|
227
|
+
385,
|
228
|
+
385,
|
229
|
+
null,
|
230
|
+
130,
|
210
231
|
null,
|
211
232
|
null,
|
212
233
|
1,
|
213
234
|
null,
|
214
235
|
1,
|
215
|
-
|
216
|
-
|
236
|
+
453,
|
237
|
+
453,
|
217
238
|
null,
|
218
239
|
46,
|
219
240
|
null,
|
220
241
|
41,
|
221
242
|
null,
|
222
|
-
|
243
|
+
27,
|
223
244
|
null,
|
224
245
|
4,
|
225
246
|
null,
|
226
|
-
|
247
|
+
9,
|
227
248
|
null,
|
228
249
|
63,
|
229
250
|
null,
|
@@ -239,9 +260,9 @@
|
|
239
260
|
1,
|
240
261
|
null,
|
241
262
|
null,
|
242
|
-
|
263
|
+
259,
|
243
264
|
null,
|
244
|
-
|
265
|
+
435,
|
245
266
|
null,
|
246
267
|
null,
|
247
268
|
1,
|
@@ -257,6 +278,9 @@
|
|
257
278
|
14,
|
258
279
|
null,
|
259
280
|
null,
|
281
|
+
null,
|
282
|
+
null,
|
283
|
+
null,
|
260
284
|
8,
|
261
285
|
8,
|
262
286
|
null,
|
@@ -288,26 +312,25 @@
|
|
288
312
|
null,
|
289
313
|
null,
|
290
314
|
2,
|
291
|
-
null,
|
292
315
|
63,
|
293
316
|
53,
|
294
317
|
null,
|
295
318
|
null,
|
296
319
|
1,
|
297
|
-
|
298
|
-
|
320
|
+
385,
|
321
|
+
385,
|
299
322
|
null,
|
300
|
-
|
323
|
+
6,
|
301
324
|
null,
|
302
|
-
|
325
|
+
5,
|
303
326
|
null,
|
304
327
|
11,
|
305
328
|
null,
|
306
|
-
|
329
|
+
6,
|
307
330
|
null,
|
308
|
-
|
331
|
+
357,
|
309
332
|
null,
|
310
|
-
|
333
|
+
385,
|
311
334
|
null,
|
312
335
|
null,
|
313
336
|
1,
|
@@ -339,27 +362,27 @@
|
|
339
362
|
null,
|
340
363
|
null,
|
341
364
|
1,
|
342
|
-
|
365
|
+
27,
|
343
366
|
1,
|
344
367
|
null,
|
345
|
-
|
346
|
-
|
347
|
-
|
368
|
+
26,
|
369
|
+
26,
|
370
|
+
26,
|
348
371
|
null,
|
349
372
|
null,
|
350
373
|
1,
|
351
374
|
1,
|
352
375
|
null,
|
353
376
|
null,
|
354
|
-
|
377
|
+
26,
|
355
378
|
null,
|
356
379
|
null,
|
357
380
|
null,
|
358
381
|
null,
|
359
|
-
|
360
|
-
|
382
|
+
105,
|
383
|
+
105,
|
361
384
|
null,
|
362
|
-
|
385
|
+
26,
|
363
386
|
null,
|
364
387
|
null,
|
365
388
|
1,
|
@@ -367,14 +390,14 @@
|
|
367
390
|
null,
|
368
391
|
null,
|
369
392
|
1,
|
370
|
-
|
371
|
-
|
372
|
-
|
393
|
+
9,
|
394
|
+
9,
|
395
|
+
9,
|
373
396
|
null,
|
374
397
|
null,
|
375
398
|
null,
|
376
399
|
1,
|
377
|
-
|
400
|
+
280,
|
378
401
|
null,
|
379
402
|
null,
|
380
403
|
1,
|
@@ -395,13 +418,13 @@
|
|
395
418
|
null,
|
396
419
|
null,
|
397
420
|
1,
|
398
|
-
|
399
|
-
|
421
|
+
6,
|
422
|
+
6,
|
400
423
|
null,
|
401
424
|
null,
|
402
425
|
1,
|
403
|
-
|
404
|
-
|
426
|
+
5,
|
427
|
+
5,
|
405
428
|
null,
|
406
429
|
null,
|
407
430
|
1,
|
@@ -410,20 +433,20 @@
|
|
410
433
|
null,
|
411
434
|
null,
|
412
435
|
1,
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
436
|
+
6,
|
437
|
+
6,
|
438
|
+
6,
|
439
|
+
6,
|
440
|
+
6,
|
441
|
+
6,
|
419
442
|
null,
|
420
443
|
null,
|
421
444
|
1,
|
422
|
-
|
445
|
+
357,
|
423
446
|
null,
|
424
447
|
null,
|
425
448
|
1,
|
426
|
-
|
449
|
+
306,
|
427
450
|
null,
|
428
451
|
null,
|
429
452
|
null,
|
@@ -437,68 +460,75 @@
|
|
437
460
|
1,
|
438
461
|
1,
|
439
462
|
1,
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
463
|
+
1882,
|
464
|
+
1882,
|
465
|
+
1882,
|
466
|
+
142,
|
444
467
|
null,
|
445
|
-
|
468
|
+
1882,
|
446
469
|
null,
|
447
470
|
null,
|
448
471
|
1,
|
449
|
-
|
472
|
+
1939,
|
450
473
|
null,
|
451
474
|
null,
|
452
475
|
null,
|
453
476
|
null,
|
454
477
|
1,
|
455
|
-
|
478
|
+
499,
|
456
479
|
null,
|
457
480
|
null,
|
458
481
|
null,
|
459
482
|
1,
|
460
483
|
1,
|
461
|
-
|
484
|
+
280,
|
462
485
|
null,
|
463
486
|
1,
|
464
|
-
|
487
|
+
242,
|
465
488
|
null,
|
466
489
|
null,
|
467
490
|
null,
|
468
491
|
1,
|
469
492
|
1,
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
493
|
+
40,
|
494
|
+
40,
|
495
|
+
11,
|
496
|
+
11,
|
474
497
|
null,
|
475
|
-
|
498
|
+
29,
|
476
499
|
null,
|
477
500
|
null,
|
478
|
-
|
479
|
-
|
501
|
+
40,
|
502
|
+
40,
|
480
503
|
null,
|
481
504
|
null,
|
482
505
|
1,
|
483
506
|
null,
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
507
|
+
40,
|
508
|
+
40,
|
509
|
+
40,
|
510
|
+
40,
|
488
511
|
null,
|
489
|
-
|
490
|
-
|
512
|
+
40,
|
513
|
+
null,
|
514
|
+
null,
|
515
|
+
26,
|
516
|
+
15,
|
517
|
+
15,
|
518
|
+
null,
|
519
|
+
11,
|
491
520
|
null,
|
492
521
|
null,
|
493
|
-
|
494
|
-
|
522
|
+
null,
|
523
|
+
40,
|
524
|
+
40,
|
495
525
|
null,
|
496
526
|
null,
|
497
527
|
1,
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
528
|
+
40,
|
529
|
+
1430,
|
530
|
+
32,
|
531
|
+
22,
|
502
532
|
null,
|
503
533
|
1,
|
504
534
|
null,
|
@@ -511,9 +541,17 @@
|
|
511
541
|
null,
|
512
542
|
null,
|
513
543
|
1,
|
514
|
-
|
515
|
-
|
544
|
+
40,
|
545
|
+
590,
|
546
|
+
null,
|
547
|
+
null,
|
548
|
+
null,
|
549
|
+
1,
|
550
|
+
1,
|
551
|
+
547,
|
552
|
+
10,
|
516
553
|
null,
|
554
|
+
22,
|
517
555
|
null,
|
518
556
|
null,
|
519
557
|
null,
|
@@ -538,7 +576,7 @@
|
|
538
576
|
1,
|
539
577
|
186,
|
540
578
|
41,
|
541
|
-
|
579
|
+
113,
|
542
580
|
null,
|
543
581
|
null,
|
544
582
|
null,
|
@@ -548,19 +586,17 @@
|
|
548
586
|
null,
|
549
587
|
1,
|
550
588
|
1,
|
551
|
-
|
552
|
-
|
589
|
+
9,
|
590
|
+
9,
|
553
591
|
null,
|
554
592
|
null,
|
555
|
-
1,
|
556
|
-
6,
|
557
|
-
6,
|
558
593
|
null,
|
559
|
-
|
560
|
-
|
594
|
+
1,
|
595
|
+
9,
|
596
|
+
9,
|
561
597
|
null,
|
562
|
-
|
563
|
-
|
598
|
+
9,
|
599
|
+
29,
|
564
600
|
null,
|
565
601
|
null,
|
566
602
|
null,
|
@@ -582,12 +618,16 @@
|
|
582
618
|
1,
|
583
619
|
1,
|
584
620
|
1,
|
585
|
-
93,
|
586
621
|
null,
|
587
622
|
null,
|
588
|
-
|
589
|
-
|
590
|
-
|
623
|
+
null,
|
624
|
+
null,
|
625
|
+
null,
|
626
|
+
null,
|
627
|
+
106,
|
628
|
+
null,
|
629
|
+
null,
|
630
|
+
89,
|
591
631
|
null,
|
592
632
|
null,
|
593
633
|
1,
|
@@ -597,11 +637,11 @@
|
|
597
637
|
"/home/tom/git/regexp-examples/spec/regexp-examples_spec.rb": [
|
598
638
|
1,
|
599
639
|
1,
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
640
|
+
12,
|
641
|
+
79,
|
642
|
+
79,
|
643
|
+
79,
|
644
|
+
262,
|
605
645
|
null,
|
606
646
|
null,
|
607
647
|
null,
|
@@ -628,6 +668,14 @@
|
|
628
668
|
null,
|
629
669
|
1,
|
630
670
|
1,
|
671
|
+
10,
|
672
|
+
10,
|
673
|
+
null,
|
674
|
+
null,
|
675
|
+
null,
|
676
|
+
null,
|
677
|
+
1,
|
678
|
+
1,
|
631
679
|
1,
|
632
680
|
null,
|
633
681
|
null,
|
@@ -666,6 +714,8 @@
|
|
666
714
|
null,
|
667
715
|
null,
|
668
716
|
null,
|
717
|
+
null,
|
718
|
+
null,
|
669
719
|
1,
|
670
720
|
1,
|
671
721
|
null,
|
@@ -719,6 +769,7 @@
|
|
719
769
|
null,
|
720
770
|
null,
|
721
771
|
null,
|
772
|
+
null,
|
722
773
|
1,
|
723
774
|
1,
|
724
775
|
null,
|
@@ -786,10 +837,31 @@
|
|
786
837
|
null,
|
787
838
|
null,
|
788
839
|
null,
|
840
|
+
1,
|
841
|
+
1,
|
842
|
+
null,
|
843
|
+
null,
|
844
|
+
null,
|
845
|
+
null,
|
846
|
+
null,
|
847
|
+
null,
|
848
|
+
null,
|
849
|
+
null,
|
850
|
+
null,
|
851
|
+
null,
|
852
|
+
null,
|
853
|
+
null,
|
854
|
+
null,
|
855
|
+
1,
|
856
|
+
1,
|
857
|
+
null,
|
858
|
+
null,
|
859
|
+
null,
|
860
|
+
null,
|
789
861
|
null,
|
790
862
|
null
|
791
863
|
]
|
792
864
|
},
|
793
|
-
"timestamp":
|
865
|
+
"timestamp": 1422115371
|
794
866
|
}
|
795
867
|
}
|