regexp-examples 0.2.4 → 0.3.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.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +10 -7
- data/coverage/.resultset.json +151 -79
- data/coverage/index.html +896 -464
- data/lib/regexp-examples/parser.rb +40 -5
- data/lib/regexp-examples/version.rb +1 -1
- data/regexp-examples.gemspec +2 -2
- data/spec/regexp-examples_spec.rb +39 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 070f108bdf60292bcb76bfcfc9036d7681f46844
|
4
|
+
data.tar.gz: cd09253f3ec4c272e4e6dd895c69334def2d3321
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c984b1d6dab4488368d85373099cd5c64e2406cd4f100957cfa413662e4f78307bfa1a06a641d670c0e9fc7e0bc9821c10acd34851f6408d9afbde44b0b72b66
|
7
|
+
data.tar.gz: 77b51a5c67c4b1a1a357a123049848a43e4bcf29f89aa2cc3ba3272f6e032d1ea5e7363317e7ce38b0af5741ffcc190604cace8a79108e0ccd8c83682ddc71d8
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -39,17 +39,17 @@ or a huge number of possible matches, such as `/.\w/`, then only a subset of the
|
|
39
39
|
* ...And backreferences(!!!), e.g. `/(this|that) \1/` `/(?<name>foo) \k<name>/`
|
40
40
|
* Groups work fine, even if nested! e.g. `/(even(this(works?))) \1 \2 \3/`
|
41
41
|
* Control characters, e.g. `/\ca/`, `/\cZ/`, `/\C-9/`
|
42
|
-
* Escape sequences, e.g. `/\x42/`, `/\x3D/`, `/\
|
43
|
-
* Unicode characters, e.g. `/\u0123/`, `/\uabcd/`
|
42
|
+
* Escape sequences, e.g. `/\x42/`, `/\x3D/`, `/\x5word/`, `/#{"\x80".force_encoding("ASCII-8BIT")}/`
|
43
|
+
* Unicode characters, e.g. `/\u0123/`, `/\uabcd/`, `/\u{789}/`
|
44
44
|
* **Arbitrarily complex combinations of all the above!**
|
45
45
|
|
46
46
|
## Not-Yet-Supported syntax
|
47
47
|
|
48
|
-
|
48
|
+
* Options, e.g. `/pattern/i`, `/foo.*bar/m` - Using options will currently just be ignored, e.g. `/test/i.examples` will NOT include `"TEST"`
|
49
|
+
|
50
|
+
Using any of the following will raise an RegexpExamples::UnsupportedSyntax exception (until such time as they are implemented!):
|
49
51
|
|
50
|
-
* Throw exceptions if illegal syntax (see below) is used. This is currently only partially implemented (for lookarounds only).
|
51
52
|
* POSIX bracket expressions, e.g. `/[[:alnum:]]/`, `/[[:space:]]/`
|
52
|
-
* Options, e.g. `/pattern/i`, `/foo.*bar/m`
|
53
53
|
* Named properties, e.g. `/\p{L}/` ("Letter"), `/\p{Arabic}/` ("Arabic character"), `/\p{^Ll}/` ("Not a lowercase letter")
|
54
54
|
* Subexpression calls, e.g. `/(?<name> ... \g<name>* )/` (Note: These could get _really_ ugly to implement, and may even be impossible, so I highly doubt it's worth the effort!)
|
55
55
|
|
@@ -58,8 +58,11 @@ I plan to add the following features to the gem, but have not yet got round to i
|
|
58
58
|
The following features in the regex language can never be properly implemented into this gem because, put simply, they are not technically "regular"!
|
59
59
|
If you'd like to understand this in more detail, there are many good blog posts out on the internet. The [wikipedia entry](http://en.wikipedia.org/wiki/Regular_expression)'s not bad either.
|
60
60
|
|
61
|
-
|
62
|
-
|
61
|
+
Using any of the following will raise an RegexpExamples::IllegalSyntax exception:
|
62
|
+
|
63
|
+
* Lookarounds, e.g. `/foo(?=bar)/`, `/foo(?!bar)/`, `/(?<=foo)bar/`, `/(?<!foo)bar/`
|
64
|
+
* [Anchors](http://ruby-doc.org/core-2.2.0/Regexp.html#class-Regexp-label-Anchors) (`\b`, `\B`, `\G`, `^`, `\A`, `$`, `\z`, `\Z`), e.g. `/\bword\b/`, `/line1\n^line2/`
|
65
|
+
* However, a special case has been made to allow `^` and `\A` at the start of a pattern; and to allow `$`, `\z` and `\Z` at the end of pattern. In such cases, the characters are effectively just ignored.
|
63
66
|
|
64
67
|
(Note: Backreferences are not really "regular" either, but I got these to work with a bit of hackery!)
|
65
68
|
|
data/coverage/.resultset.json
CHANGED
@@ -16,19 +16,19 @@
|
|
16
16
|
null,
|
17
17
|
null,
|
18
18
|
1,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
319,
|
20
|
+
319,
|
21
|
+
191,
|
22
|
+
264,
|
23
23
|
null,
|
24
24
|
null,
|
25
25
|
null,
|
26
26
|
1,
|
27
|
-
|
28
|
-
|
27
|
+
264,
|
28
|
+
264,
|
29
29
|
null,
|
30
30
|
null,
|
31
|
-
|
31
|
+
264,
|
32
32
|
null,
|
33
33
|
null,
|
34
34
|
null
|
@@ -38,28 +38,28 @@
|
|
38
38
|
1,
|
39
39
|
1,
|
40
40
|
1,
|
41
|
-
|
41
|
+
360,
|
42
42
|
null,
|
43
43
|
null,
|
44
44
|
1,
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
319,
|
46
|
+
319,
|
47
|
+
319,
|
48
|
+
349,
|
49
|
+
463,
|
50
50
|
null,
|
51
51
|
null,
|
52
|
-
|
52
|
+
319,
|
53
53
|
null,
|
54
54
|
null,
|
55
55
|
null,
|
56
56
|
1,
|
57
57
|
1,
|
58
|
-
|
58
|
+
335,
|
59
59
|
null,
|
60
60
|
null,
|
61
61
|
1,
|
62
|
-
|
62
|
+
294,
|
63
63
|
null,
|
64
64
|
null,
|
65
65
|
null,
|
@@ -117,11 +117,11 @@
|
|
117
117
|
1,
|
118
118
|
1,
|
119
119
|
1,
|
120
|
-
|
121
|
-
|
120
|
+
75,
|
121
|
+
171,
|
122
122
|
28,
|
123
123
|
null,
|
124
|
-
|
124
|
+
171,
|
125
125
|
null,
|
126
126
|
null,
|
127
127
|
null,
|
@@ -192,48 +192,60 @@
|
|
192
192
|
1,
|
193
193
|
1,
|
194
194
|
1,
|
195
|
-
|
196
|
-
|
197
|
-
|
195
|
+
92,
|
196
|
+
92,
|
197
|
+
92,
|
198
198
|
null,
|
199
199
|
null,
|
200
200
|
1,
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
201
|
+
140,
|
202
|
+
140,
|
203
|
+
419,
|
204
|
+
401,
|
205
|
+
360,
|
206
|
+
360,
|
207
|
+
360,
|
208
208
|
null,
|
209
|
-
|
209
|
+
122,
|
210
210
|
null,
|
211
211
|
null,
|
212
212
|
1,
|
213
213
|
null,
|
214
214
|
1,
|
215
|
-
|
216
|
-
|
215
|
+
419,
|
216
|
+
419,
|
217
217
|
null,
|
218
|
-
|
218
|
+
46,
|
219
219
|
null,
|
220
220
|
41,
|
221
221
|
null,
|
222
|
-
|
222
|
+
15,
|
223
223
|
null,
|
224
|
-
|
224
|
+
4,
|
225
225
|
null,
|
226
226
|
6,
|
227
227
|
null,
|
228
|
-
|
228
|
+
63,
|
229
|
+
null,
|
230
|
+
2,
|
231
|
+
1,
|
232
|
+
null,
|
233
|
+
1,
|
234
|
+
null,
|
235
|
+
null,
|
236
|
+
2,
|
237
|
+
1,
|
238
|
+
null,
|
239
|
+
1,
|
240
|
+
null,
|
229
241
|
null,
|
230
|
-
|
242
|
+
240,
|
231
243
|
null,
|
232
|
-
|
244
|
+
401,
|
233
245
|
null,
|
234
246
|
null,
|
235
247
|
1,
|
236
|
-
|
248
|
+
63,
|
237
249
|
null,
|
238
250
|
null,
|
239
251
|
19,
|
@@ -245,25 +257,45 @@
|
|
245
257
|
14,
|
246
258
|
null,
|
247
259
|
null,
|
248
|
-
null,
|
249
260
|
8,
|
250
261
|
8,
|
251
262
|
null,
|
252
263
|
3,
|
253
264
|
3,
|
254
265
|
null,
|
266
|
+
3,
|
267
|
+
3,
|
268
|
+
3,
|
269
|
+
null,
|
270
|
+
3,
|
271
|
+
3,
|
272
|
+
null,
|
273
|
+
null,
|
274
|
+
1,
|
275
|
+
null,
|
276
|
+
3,
|
277
|
+
null,
|
278
|
+
2,
|
279
|
+
1,
|
280
|
+
null,
|
281
|
+
1,
|
282
|
+
null,
|
283
|
+
null,
|
284
|
+
4,
|
255
285
|
2,
|
286
|
+
null,
|
256
287
|
2,
|
257
288
|
null,
|
289
|
+
null,
|
258
290
|
2,
|
259
291
|
null,
|
260
|
-
|
261
|
-
|
292
|
+
63,
|
293
|
+
53,
|
262
294
|
null,
|
263
295
|
null,
|
264
296
|
1,
|
265
|
-
|
266
|
-
|
297
|
+
360,
|
298
|
+
360,
|
267
299
|
null,
|
268
300
|
5,
|
269
301
|
null,
|
@@ -273,16 +305,16 @@
|
|
273
305
|
null,
|
274
306
|
5,
|
275
307
|
null,
|
276
|
-
|
308
|
+
335,
|
277
309
|
null,
|
278
|
-
|
310
|
+
360,
|
279
311
|
null,
|
280
312
|
null,
|
281
313
|
1,
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
314
|
+
46,
|
315
|
+
46,
|
316
|
+
46,
|
317
|
+
46,
|
286
318
|
null,
|
287
319
|
null,
|
288
320
|
38,
|
@@ -294,11 +326,11 @@
|
|
294
326
|
null,
|
295
327
|
2,
|
296
328
|
null,
|
297
|
-
|
298
|
-
|
299
|
-
|
329
|
+
3,
|
330
|
+
3,
|
331
|
+
46,
|
300
332
|
null,
|
301
|
-
|
333
|
+
42,
|
302
334
|
41,
|
303
335
|
null,
|
304
336
|
null,
|
@@ -307,6 +339,9 @@
|
|
307
339
|
null,
|
308
340
|
null,
|
309
341
|
1,
|
342
|
+
15,
|
343
|
+
1,
|
344
|
+
null,
|
310
345
|
14,
|
311
346
|
14,
|
312
347
|
14,
|
@@ -328,7 +363,7 @@
|
|
328
363
|
null,
|
329
364
|
null,
|
330
365
|
1,
|
331
|
-
|
366
|
+
4,
|
332
367
|
null,
|
333
368
|
null,
|
334
369
|
1,
|
@@ -339,7 +374,7 @@
|
|
339
374
|
null,
|
340
375
|
null,
|
341
376
|
1,
|
342
|
-
|
377
|
+
261,
|
343
378
|
null,
|
344
379
|
null,
|
345
380
|
1,
|
@@ -356,7 +391,7 @@
|
|
356
391
|
null,
|
357
392
|
null,
|
358
393
|
1,
|
359
|
-
|
394
|
+
3,
|
360
395
|
null,
|
361
396
|
null,
|
362
397
|
1,
|
@@ -384,11 +419,11 @@
|
|
384
419
|
null,
|
385
420
|
null,
|
386
421
|
1,
|
387
|
-
|
422
|
+
335,
|
388
423
|
null,
|
389
424
|
null,
|
390
425
|
1,
|
391
|
-
|
426
|
+
293,
|
392
427
|
null,
|
393
428
|
null,
|
394
429
|
null,
|
@@ -402,31 +437,31 @@
|
|
402
437
|
1,
|
403
438
|
1,
|
404
439
|
1,
|
405
|
-
|
406
|
-
|
407
|
-
|
440
|
+
1758,
|
441
|
+
1758,
|
442
|
+
1758,
|
408
443
|
122,
|
409
444
|
null,
|
410
|
-
|
445
|
+
1758,
|
411
446
|
null,
|
412
447
|
null,
|
413
448
|
1,
|
414
|
-
|
449
|
+
1775,
|
415
450
|
null,
|
416
451
|
null,
|
417
452
|
null,
|
418
453
|
null,
|
419
454
|
1,
|
420
|
-
|
455
|
+
463,
|
421
456
|
null,
|
422
457
|
null,
|
423
458
|
null,
|
424
459
|
1,
|
425
460
|
1,
|
426
|
-
|
461
|
+
261,
|
427
462
|
null,
|
428
463
|
1,
|
429
|
-
|
464
|
+
223,
|
430
465
|
null,
|
431
466
|
null,
|
432
467
|
null,
|
@@ -545,12 +580,12 @@
|
|
545
580
|
1,
|
546
581
|
1,
|
547
582
|
1,
|
548
|
-
|
583
|
+
92,
|
549
584
|
null,
|
550
585
|
null,
|
551
|
-
|
552
|
-
|
553
|
-
|
586
|
+
162,
|
587
|
+
75,
|
588
|
+
75,
|
554
589
|
null,
|
555
590
|
null,
|
556
591
|
1,
|
@@ -560,11 +595,11 @@
|
|
560
595
|
"/home/tom/git/regexp-examples/spec/regexp-examples_spec.rb": [
|
561
596
|
1,
|
562
597
|
1,
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
598
|
+
11,
|
599
|
+
75,
|
600
|
+
75,
|
601
|
+
75,
|
602
|
+
246,
|
568
603
|
null,
|
569
604
|
null,
|
570
605
|
null,
|
@@ -575,8 +610,16 @@
|
|
575
610
|
null,
|
576
611
|
1,
|
577
612
|
1,
|
578
|
-
|
579
|
-
|
613
|
+
12,
|
614
|
+
24,
|
615
|
+
null,
|
616
|
+
null,
|
617
|
+
null,
|
618
|
+
null,
|
619
|
+
1,
|
620
|
+
1,
|
621
|
+
5,
|
622
|
+
10,
|
580
623
|
null,
|
581
624
|
null,
|
582
625
|
null,
|
@@ -682,6 +725,34 @@
|
|
682
725
|
null,
|
683
726
|
null,
|
684
727
|
null,
|
728
|
+
null,
|
729
|
+
null,
|
730
|
+
null,
|
731
|
+
null,
|
732
|
+
null,
|
733
|
+
null,
|
734
|
+
null,
|
735
|
+
null,
|
736
|
+
1,
|
737
|
+
1,
|
738
|
+
null,
|
739
|
+
null,
|
740
|
+
null,
|
741
|
+
null,
|
742
|
+
null,
|
743
|
+
null,
|
744
|
+
null,
|
745
|
+
null,
|
746
|
+
1,
|
747
|
+
1,
|
748
|
+
null,
|
749
|
+
null,
|
750
|
+
null,
|
751
|
+
null,
|
752
|
+
null,
|
753
|
+
null,
|
754
|
+
null,
|
755
|
+
null,
|
685
756
|
1,
|
686
757
|
1,
|
687
758
|
null,
|
@@ -712,9 +783,10 @@
|
|
712
783
|
null,
|
713
784
|
null,
|
714
785
|
null,
|
786
|
+
null,
|
715
787
|
null
|
716
788
|
]
|
717
789
|
},
|
718
|
-
"timestamp":
|
790
|
+
"timestamp": 1421519798
|
719
791
|
}
|
720
792
|
}
|