regexp-examples 0.2.3 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2f696b21ebbe5164c14d844c44b671b615f1b4e
4
- data.tar.gz: 0b5dab06bf4adcb6264db9b779e1ea9a23bcc232
3
+ metadata.gz: 57d9fba55197325b1b40db482d14f45b0c3907a3
4
+ data.tar.gz: 3b323dab50c314d42b99300169dfc02bbf084645
5
5
  SHA512:
6
- metadata.gz: 9735ff7a5a375eecbf8221300338a31277ae47721d55cfbe77d27e7e1c6f28528d26d3f759e9a031bcfaf15d45ccc0032bb76c2969226c51efd15c7d8521754e
7
- data.tar.gz: bf6e52c73c457b070dc91303e9e023e7703e1b3a795ad5fb8f1a6a8c221942f815da29358a53126b026bb5b5c7fa2ef8c1e6e4e9032b21e57aaf7a426c6b4813
6
+ metadata.gz: 6e872cc1a32c5c0582909e8cd8587806a1bb03c33cd3f15dc94f717db9eb58d0636b1f34993d1fc30752c63a445e7911fa3d4d5e6f6d420f271d8d6f20d3affb
7
+ data.tar.gz: e04349b682c70ba5b4bc62290ba2476357ccc6f1e611df103f535df9ca1aad243ed76d7ca4013f461e67fd87996765b29a1fea063fede0df3830e8973dba78f5
data/README.md CHANGED
@@ -22,6 +22,8 @@ or a huge number of possible matches, such as `/.\w/`, then only a subset of the
22
22
  /https?:\/\/(www\.)?github\.com/.examples #=> ['http://github.com',
23
23
  # 'http://www.github.com', 'https://github.com', 'https://www.github.com']
24
24
  /(I(N(C(E(P(T(I(O(N)))))))))*/.examples #=> ["", "INCEPTION", "INCEPTIONINCEPTION"]
25
+ /\x74\x68\x69\x73/.examples #=> ["this"]
26
+ /\u6829/.examples #=> ["栩"]
25
27
  /what about (backreferences\?) \1/.examples #=> ['what about backreferences? backreferences?']
26
28
  ```
27
29
 
@@ -36,7 +38,9 @@ or a huge number of possible matches, such as `/.\w/`, then only a subset of the
36
38
  * Including named groups, e.g. `/(?<name>group)/`
37
39
  * ...And backreferences(!!!), e.g. `/(this|that) \1/` `/(?<name>foo) \k<name>/`
38
40
  * Groups work fine, even if nested! e.g. `/(even(this(works?))) \1 \2 \3/`
39
- * Control characters, e.g. `/\ca/`, `/\cZ/`, `/\c9/`
41
+ * Control characters, e.g. `/\ca/`, `/\cZ/`, `/\C-9/`
42
+ * Escape sequences, e.g. `/\x42/`, `/\x3D/`, `/\5word/`, `/#{"\x80".force_encoding("ASCII-8BIT")}/`
43
+ * Unicode characters, e.g. `/\u0123/`, `/\uabcd/`
40
44
  * **Arbitrarily complex combinations of all the above!**
41
45
 
42
46
  ## Not-Yet-Supported syntax
@@ -46,8 +50,6 @@ I plan to add the following features to the gem, but have not yet got round to i
46
50
  * Throw exceptions if illegal syntax (see below) is used. This is currently only partially implemented (for lookarounds only).
47
51
  * POSIX bracket expressions, e.g. `/[[:alnum:]]/`, `/[[:space:]]/`
48
52
  * Options, e.g. `/pattern/i`, `/foo.*bar/m`
49
- * Escape sequences, e.g. `/\xa1/`
50
- * Unicode characters, e.g. `/\u06E9/`
51
53
  * Named properties, e.g. `/\p{L}/` ("Letter"), `/\p{Arabic}/` ("Arabic character"), `/\p{^Ll}/` ("Not a lowercase letter")
52
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!)
53
55
 
@@ -1,18 +1,11 @@
1
1
  {
2
2
  "RSpec": {
3
3
  "coverage": {
4
- "/home/tom/regexp-examples/lib/regexp-examples.rb": [
4
+ "/home/tom/git/regexp-examples/lib/regexp-examples.rb": [
5
5
  10,
6
6
  null
7
7
  ],
8
- "/home/tom/regexp-examples/lib/regexp-examples/exceptions.rb": [
9
- 1,
10
- 1,
11
- 1,
12
- 1,
13
- null
14
- ],
15
- "/home/tom/regexp-examples/lib/regexp-examples/helpers.rb": [
8
+ "/home/tom/git/regexp-examples/lib/regexp-examples/helpers.rb": [
16
9
  1,
17
10
  null,
18
11
  null,
@@ -23,365 +16,385 @@
23
16
  null,
24
17
  null,
25
18
  1,
26
- 278,
27
- 278,
28
- 164,
29
- 237,
19
+ 290,
20
+ 290,
21
+ 168,
22
+ 241,
30
23
  null,
31
24
  null,
32
25
  null,
33
26
  1,
34
- 237,
35
- 237,
27
+ 241,
28
+ 241,
36
29
  null,
37
30
  null,
38
- 237,
31
+ 241,
39
32
  null,
40
33
  null,
41
34
  null
42
35
  ],
43
- "/home/tom/regexp-examples/lib/regexp-examples/parser.rb": [
36
+ "/home/tom/git/regexp-examples/lib/regexp-examples/repeaters.rb": [
44
37
  1,
45
38
  1,
46
39
  1,
47
40
  1,
48
- 65,
49
- 65,
50
- 65,
41
+ 290,
51
42
  null,
52
43
  null,
53
44
  1,
54
- 112,
55
- 112,
56
- 323,
57
- 319,
58
- 278,
59
- 278,
60
- 278,
45
+ 290,
46
+ 290,
47
+ 290,
48
+ 320,
49
+ 434,
61
50
  null,
62
- 108,
51
+ null,
52
+ 290,
63
53
  null,
64
54
  null,
65
- 1,
66
55
  null,
67
56
  1,
68
- 323,
69
- 323,
57
+ 1,
58
+ 265,
70
59
  null,
71
- 45,
72
60
  null,
73
- 41,
61
+ 1,
62
+ 265,
63
+ null,
74
64
  null,
75
- 14,
76
65
  null,
77
66
  1,
67
+ 1,
68
+ 5,
78
69
  null,
79
- 6,
80
70
  null,
81
- 42,
71
+ 1,
72
+ 5,
73
+ null,
82
74
  null,
83
- 174,
84
75
  null,
85
- 319,
76
+ 1,
77
+ 1,
78
+ 4,
86
79
  null,
87
80
  null,
88
81
  1,
89
- 42,
82
+ 4,
90
83
  null,
91
84
  null,
92
- 19,
93
- 19,
94
85
  null,
95
86
  1,
96
87
  1,
88
+ 11,
97
89
  null,
98
- 14,
99
90
  null,
91
+ 1,
92
+ 11,
100
93
  null,
101
- 6,
102
- 6,
103
94
  null,
104
95
  null,
96
+ 1,
97
+ 1,
98
+ 5,
99
+ 5,
100
+ 5,
101
+ 2,
102
+ 3,
103
+ 1,
105
104
  null,
106
105
  2,
107
106
  null,
108
- 42,
109
- 42,
110
107
  null,
111
108
  null,
112
109
  1,
113
- 278,
114
- 278,
115
- null,
116
110
  5,
117
111
  null,
118
- 4,
119
112
  null,
120
- 11,
121
113
  null,
122
- 5,
114
+ null
115
+ ],
116
+ "/home/tom/git/regexp-examples/lib/regexp-examples/backreferences.rb": [
117
+ 1,
118
+ 1,
119
+ 1,
120
+ 69,
121
+ 165,
122
+ 28,
123
123
  null,
124
- 253,
124
+ 165,
125
125
  null,
126
- 278,
127
126
  null,
128
127
  null,
129
128
  1,
130
- 45,
131
- 45,
132
- 45,
133
- 45,
129
+ 1,
130
+ 28,
131
+ 76,
132
+ null,
134
133
  null,
135
134
  null,
136
- 38,
137
135
  null,
136
+ null,
137
+ null
138
+ ],
139
+ "/home/tom/git/regexp-examples/lib/regexp-examples/exceptions.rb": [
138
140
  1,
141
+ 1,
142
+ 1,
143
+ 1,
144
+ null
145
+ ],
146
+ "/home/tom/git/regexp-examples/lib/regexp-examples/constants.rb": [
139
147
  1,
140
148
  null,
141
- 2,
149
+ 1,
142
150
  null,
143
- 2,
144
151
  null,
145
- 2,
146
- 2,
147
- 45,
148
152
  null,
149
- 41,
150
- 41,
151
153
  null,
152
154
  null,
153
155
  1,
154
- 41,
155
- null,
156
156
  null,
157
157
  1,
158
- 14,
159
- 14,
160
- 14,
158
+ 1,
159
+ 1,
160
+ 1,
161
161
  null,
162
162
  null,
163
+ 39,
163
164
  1,
164
165
  1,
165
166
  null,
166
167
  null,
167
- 14,
168
- null,
169
168
  null,
169
+ 1,
170
170
  null,
171
171
  null,
172
- 41,
173
- 41,
174
172
  null,
175
- 14,
173
+ 32,
176
174
  null,
177
175
  null,
178
- 1,
179
- 1,
180
176
  null,
181
177
  null,
182
- 1,
183
- 6,
184
- 6,
185
- 6,
186
178
  null,
187
179
  null,
188
180
  null,
189
- 1,
190
- 182,
191
181
  null,
192
182
  null,
193
- 1,
194
- 20,
195
183
  null,
196
184
  null,
197
- 1,
198
185
  null,
199
- 125,
200
186
  null,
201
187
  null,
188
+ null
189
+ ],
190
+ "/home/tom/git/regexp-examples/lib/regexp-examples/parser.rb": [
202
191
  1,
203
- 5,
204
- 5,
205
- null,
206
- null,
207
192
  1,
208
- 4,
209
- 4,
210
- null,
211
- null,
212
193
  1,
213
- 11,
214
- 11,
194
+ 1,
195
+ 73,
196
+ 73,
197
+ 73,
215
198
  null,
216
199
  null,
217
200
  1,
218
- 5,
219
- 5,
220
- 5,
221
- 5,
222
- 5,
223
- 5,
201
+ 120,
202
+ 120,
203
+ 335,
204
+ 331,
205
+ 290,
206
+ 290,
207
+ 290,
224
208
  null,
209
+ 116,
225
210
  null,
226
- 1,
227
- 253,
228
211
  null,
212
+ 1,
229
213
  null,
230
214
  1,
231
- 123,
215
+ 335,
216
+ 335,
232
217
  null,
218
+ 45,
233
219
  null,
220
+ 41,
234
221
  null,
235
- null
236
- ],
237
- "/home/tom/regexp-examples/lib/regexp-examples/constants.rb": [
238
- 1,
222
+ 14,
239
223
  null,
240
224
  1,
241
225
  null,
226
+ 6,
242
227
  null,
228
+ 49,
243
229
  null,
230
+ 179,
244
231
  null,
232
+ 331,
245
233
  null,
246
- 1,
247
234
  null,
248
235
  1,
249
- 1,
250
- 1,
251
- 1,
236
+ 49,
252
237
  null,
253
238
  null,
254
- 39,
239
+ 19,
240
+ 19,
241
+ null,
255
242
  1,
256
243
  1,
257
244
  null,
258
- null,
259
- null,
260
- 1,
245
+ 14,
261
246
  null,
262
247
  null,
263
248
  null,
264
- 32,
249
+ 8,
250
+ 8,
265
251
  null,
252
+ 3,
253
+ 3,
266
254
  null,
255
+ 2,
256
+ 2,
267
257
  null,
258
+ 2,
268
259
  null,
260
+ 49,
261
+ 49,
269
262
  null,
270
263
  null,
264
+ 1,
265
+ 290,
266
+ 290,
271
267
  null,
268
+ 5,
272
269
  null,
270
+ 4,
273
271
  null,
272
+ 11,
274
273
  null,
274
+ 5,
275
275
  null,
276
+ 265,
276
277
  null,
278
+ 290,
277
279
  null,
278
280
  null,
279
- null
280
- ],
281
- "/home/tom/regexp-examples/lib/regexp-examples/backreferences.rb": [
282
- 1,
283
281
  1,
284
- 1,
285
- 61,
286
- 157,
287
- 28,
288
- null,
289
- 157,
282
+ 45,
283
+ 45,
284
+ 45,
285
+ 45,
290
286
  null,
291
287
  null,
288
+ 38,
292
289
  null,
293
290
  1,
294
291
  1,
295
- 28,
296
- 76,
297
292
  null,
293
+ 2,
298
294
  null,
295
+ 2,
299
296
  null,
297
+ 2,
298
+ 2,
299
+ 45,
300
+ null,
301
+ 41,
302
+ 41,
300
303
  null,
301
304
  null,
302
- null
303
- ],
304
- "/home/tom/regexp-examples/lib/regexp-examples/repeaters.rb": [
305
305
  1,
306
+ 41,
307
+ null,
308
+ null,
306
309
  1,
310
+ 14,
311
+ 14,
312
+ 14,
313
+ null,
314
+ null,
307
315
  1,
308
316
  1,
309
- 278,
310
317
  null,
311
318
  null,
312
- 1,
313
- 278,
314
- 278,
315
- 278,
316
- 308,
317
- 422,
319
+ 14,
320
+ null,
318
321
  null,
319
322
  null,
320
- 278,
321
323
  null,
324
+ 41,
325
+ 41,
326
+ null,
327
+ 14,
322
328
  null,
323
329
  null,
324
330
  1,
325
331
  1,
326
- 253,
327
332
  null,
328
333
  null,
329
334
  1,
330
- 253,
335
+ 6,
336
+ 6,
337
+ 6,
331
338
  null,
332
339
  null,
333
340
  null,
334
341
  1,
342
+ 194,
343
+ null,
344
+ null,
335
345
  1,
336
- 5,
346
+ 20,
337
347
  null,
338
348
  null,
339
349
  1,
340
- 5,
350
+ 8,
341
351
  null,
342
352
  null,
343
353
  null,
344
354
  1,
345
- 1,
346
- 4,
355
+ 3,
347
356
  null,
348
357
  null,
349
358
  1,
350
- 4,
351
- null,
359
+ 2,
352
360
  null,
353
361
  null,
354
362
  1,
363
+ 5,
364
+ 5,
365
+ null,
366
+ null,
355
367
  1,
356
- 11,
368
+ 4,
369
+ 4,
357
370
  null,
358
371
  null,
359
372
  1,
360
373
  11,
374
+ 11,
361
375
  null,
362
376
  null,
363
- null,
364
- 1,
365
377
  1,
366
378
  5,
367
379
  5,
368
380
  5,
369
- 2,
370
- 3,
371
- 1,
381
+ 5,
382
+ 5,
383
+ 5,
372
384
  null,
373
- 2,
374
385
  null,
386
+ 1,
387
+ 265,
375
388
  null,
376
389
  null,
377
390
  1,
378
- 5,
391
+ 155,
379
392
  null,
380
393
  null,
381
394
  null,
382
395
  null
383
396
  ],
384
- "/home/tom/regexp-examples/lib/regexp-examples/groups.rb": [
397
+ "/home/tom/git/regexp-examples/lib/regexp-examples/groups.rb": [
385
398
  1,
386
399
  null,
387
400
  null,
@@ -389,31 +402,31 @@
389
402
  1,
390
403
  1,
391
404
  1,
392
- 1649,
393
- 1649,
394
- 1649,
405
+ 1677,
406
+ 1677,
407
+ 1677,
395
408
  122,
396
409
  null,
397
- 1649,
410
+ 1677,
398
411
  null,
399
412
  null,
400
413
  1,
401
- 1667,
414
+ 1683,
402
415
  null,
403
416
  null,
404
417
  null,
405
418
  null,
406
419
  1,
407
- 422,
420
+ 434,
408
421
  null,
409
422
  null,
410
423
  null,
411
424
  1,
412
425
  1,
413
- 182,
426
+ 194,
414
427
  null,
415
428
  1,
416
- 182,
429
+ 194,
417
430
  null,
418
431
  null,
419
432
  null,
@@ -528,30 +541,30 @@
528
541
  null,
529
542
  null
530
543
  ],
531
- "/home/tom/regexp-examples/lib/regexp-examples/regexp_extensions.rb": [
544
+ "/home/tom/git/regexp-examples/lib/regexp-examples/regexp_extensions.rb": [
532
545
  1,
533
546
  1,
534
547
  1,
535
- 65,
548
+ 73,
536
549
  null,
537
550
  null,
538
- 121,
539
- 61,
540
- 61,
551
+ 133,
552
+ 69,
553
+ 69,
541
554
  null,
542
555
  null,
543
556
  1,
544
557
  null,
545
558
  null
546
559
  ],
547
- "/home/tom/regexp-examples/spec/regexp-examples_spec.rb": [
560
+ "/home/tom/git/regexp-examples/spec/regexp-examples_spec.rb": [
548
561
  1,
549
562
  1,
550
- 8,
551
- 61,
552
- 61,
553
- 61,
554
- 218,
563
+ 10,
564
+ 69,
565
+ 69,
566
+ 69,
567
+ 234,
555
568
  null,
556
569
  null,
557
570
  null,
@@ -680,9 +693,28 @@
680
693
  null,
681
694
  null,
682
695
  null,
696
+ null,
697
+ null,
698
+ 1,
699
+ 1,
700
+ null,
701
+ null,
702
+ null,
703
+ null,
704
+ null,
705
+ null,
706
+ null,
707
+ 1,
708
+ 1,
709
+ null,
710
+ null,
711
+ null,
712
+ null,
713
+ null,
714
+ null,
683
715
  null
684
716
  ]
685
717
  },
686
- "timestamp": 1421429649
718
+ "timestamp": 1421512650
687
719
  }
688
720
  }