1Regexp::Pattern::DefHasUhs(e3r)Contributed Perl DocumentRaetgieoxnp::Pattern::DefHash(3)
2
3
4
6 Regexp::Pattern::DefHash - Regexp patterns related to DefHash
7
9 This document describes version 0.001 of Regexp::Pattern::DefHash (from
10 Perl distribution Regexp-Pattern-DefHash), released on 2021-07-22.
11
13 use Regexp::Pattern; # exports re()
14 my $re = re("DefHash::attr");
15
17 Regexp::Pattern is a convention for organizing reusable regex patterns.
18
20 • attr
21
22 Tags: anchored, capturing
23
24 Attribute key.
25
26 Examples:
27
28 Example #1.
29
30 ".attr" =~ re("DefHash::attr"); # matches
31
32 Example #2.
33
34 "._attr" =~ re("DefHash::attr"); # matches
35
36 Example #3.
37
38 ".attr1.subattr2" =~ re("DefHash::attr"); # matches
39
40 Example #4.
41
42 "prop.attr1" =~ re("DefHash::attr"); # matches
43
44 Example #5.
45
46 "_prop._attr1" =~ re("DefHash::attr"); # matches
47
48 Example #6.
49
50 "Prop.attr1.subattr2.Subattr3" =~ re("DefHash::attr"); # matches
51
52 Example #7.
53
54 "_prop.attr1" =~ re("DefHash::attr"); # matches
55
56 Cannot start with digit (1).
57
58 ".0attr" =~ re("DefHash::attr"); # DOESN'T MATCH
59
60 Cannot start with digit (2).
61
62 "prop.0attr" =~ re("DefHash::attr"); # DOESN'T MATCH
63
64 Cannot start with digit (3).
65
66 "prop.attr.0subattr" =~ re("DefHash::attr"); # DOESN'T MATCH
67
68 Invalid character: dash (1).
69
70 ".attr-ibute" =~ re("DefHash::attr"); # DOESN'T MATCH
71
72 Invalid character: dash (2).
73
74 "prop-erty.attribute" =~ re("DefHash::attr"); # DOESN'T MATCH
75
76 Invalid character: dash (3).
77
78 "prop.attr-ibute" =~ re("DefHash::attr"); # DOESN'T MATCH
79
80 Invalid character: whitespace (1).
81
82 "property .attr" =~ re("DefHash::attr"); # DOESN'T MATCH
83
84 Invalid character: whitespace (2).
85
86 "property.attr " =~ re("DefHash::attr"); # DOESN'T MATCH
87
88 Invalid character: whitespace (3).
89
90 ".attr " =~ re("DefHash::attr"); # DOESN'T MATCH
91
92 Invalid syntax: dot only.
93
94 "." =~ re("DefHash::attr"); # DOESN'T MATCH
95
96 Invalid syntax: double dot.
97
98 "..attr" =~ re("DefHash::attr"); # DOESN'T MATCH
99
100 Invalid syntax: dot without attr.
101
102 "attr." =~ re("DefHash::attr"); # DOESN'T MATCH
103
104 Invalid syntax: dot without attr (2).
105
106 "attr.." =~ re("DefHash::attr"); # DOESN'T MATCH
107
108 Empty.
109
110 "" =~ re("DefHash::attr"); # DOESN'T MATCH
111
112 Property, not attribute.
113
114 "p" =~ re("DefHash::attr"); # DOESN'T MATCH
115
116 Property, not attribute.
117
118 "_" =~ re("DefHash::attr"); # DOESN'T MATCH
119
120 • attr_part
121
122 Tags: anchored
123
124 Attribute part in attribute key.
125
126 Examples:
127
128 Empty.
129
130 "" =~ re("DefHash::attr_part"); # DOESN'T MATCH
131
132 Example #2.
133
134 "p" =~ re("DefHash::attr_part"); # matches
135
136 Example #3.
137
138 "p.q" =~ re("DefHash::attr_part"); # matches
139
140 Dot prefix must not be included.
141
142 ".p" =~ re("DefHash::attr_part"); # DOESN'T MATCH
143
144 • key
145
146 Tags: anchored, capturing
147
148 Attribute key or property key.
149
150 All keys in defhash must match this pattern.
151
152 Examples:
153
154 Example #1.
155
156 "p" =~ re("DefHash::key"); # matches
157
158 Example #2.
159
160 "_" =~ re("DefHash::key"); # matches
161
162 Example #3.
163
164 "prop" =~ re("DefHash::key"); # matches
165
166 Example #4.
167
168 "Prop2" =~ re("DefHash::key"); # matches
169
170 Example #5.
171
172 "prop_" =~ re("DefHash::key"); # matches
173
174 Cannot start with digit.
175
176 "0prop" =~ re("DefHash::key"); # DOESN'T MATCH
177
178 Invalid character: dash.
179
180 "prop-erty" =~ re("DefHash::key"); # DOESN'T MATCH
181
182 Invalid character: whitespace.
183
184 "property " =~ re("DefHash::key"); # DOESN'T MATCH
185
186 Example #9.
187
188 ".attr" =~ re("DefHash::key"); # matches
189
190 Example #10.
191
192 "._attr" =~ re("DefHash::key"); # matches
193
194 Example #11.
195
196 ".attr1.subattr2" =~ re("DefHash::key"); # matches
197
198 Example #12.
199
200 "prop.attr1" =~ re("DefHash::key"); # matches
201
202 Example #13.
203
204 "_prop._attr1" =~ re("DefHash::key"); # matches
205
206 Example #14.
207
208 "Prop.attr1.subattr2.Subattr3" =~ re("DefHash::key"); # matches
209
210 Example #15.
211
212 "_prop.attr1" =~ re("DefHash::key"); # matches
213
214 Cannot start with digit (1).
215
216 ".0attr" =~ re("DefHash::key"); # DOESN'T MATCH
217
218 Cannot start with digit (2).
219
220 "prop.0attr" =~ re("DefHash::key"); # DOESN'T MATCH
221
222 Cannot start with digit (3).
223
224 "prop.attr.0subattr" =~ re("DefHash::key"); # DOESN'T MATCH
225
226 Invalid character: dash (1).
227
228 ".attr-ibute" =~ re("DefHash::key"); # DOESN'T MATCH
229
230 Invalid character: dash (2).
231
232 "prop-erty.attribute" =~ re("DefHash::key"); # DOESN'T MATCH
233
234 Invalid character: dash (3).
235
236 "prop.attr-ibute" =~ re("DefHash::key"); # DOESN'T MATCH
237
238 Invalid character: whitespace (1).
239
240 "property .attr" =~ re("DefHash::key"); # DOESN'T MATCH
241
242 Invalid character: whitespace (2).
243
244 "property.attr " =~ re("DefHash::key"); # DOESN'T MATCH
245
246 Invalid character: whitespace (3).
247
248 ".attr " =~ re("DefHash::key"); # DOESN'T MATCH
249
250 Invalid syntax: dot only.
251
252 "." =~ re("DefHash::key"); # DOESN'T MATCH
253
254 Invalid syntax: double dot.
255
256 "..attr" =~ re("DefHash::key"); # DOESN'T MATCH
257
258 Invalid syntax: dot without attr.
259
260 "attr." =~ re("DefHash::key"); # DOESN'T MATCH
261
262 Invalid syntax: dot without attr (2).
263
264 "attr.." =~ re("DefHash::key"); # DOESN'T MATCH
265
266 Empty.
267
268 "" =~ re("DefHash::key"); # DOESN'T MATCH
269
270 • prop
271
272 Tags: anchored
273
274 Property key.
275
276 Examples:
277
278 Example #1.
279
280 "p" =~ re("DefHash::prop"); # matches
281
282 Example #2.
283
284 "_" =~ re("DefHash::prop"); # matches
285
286 Example #3.
287
288 "prop" =~ re("DefHash::prop"); # matches
289
290 Example #4.
291
292 "Prop2" =~ re("DefHash::prop"); # matches
293
294 Example #5.
295
296 "prop_" =~ re("DefHash::prop"); # matches
297
298 Cannot start with digit.
299
300 "0prop" =~ re("DefHash::prop"); # DOESN'T MATCH
301
302 Invalid character: dash.
303
304 "prop-erty" =~ re("DefHash::prop"); # DOESN'T MATCH
305
306 Invalid character: whitespace.
307
308 "property " =~ re("DefHash::prop"); # DOESN'T MATCH
309
310 Empty.
311
312 "" =~ re("DefHash::prop"); # DOESN'T MATCH
313
314 Attribute, not property.
315
316 "prop.attr" =~ re("DefHash::prop"); # DOESN'T MATCH
317
318 Attribute, not property.
319
320 ".attr" =~ re("DefHash::prop"); # DOESN'T MATCH
321
322 • prop_or_attr
323
324 Tags: anchored, capturing
325
326 Attribute key or property key.
327
328 All keys in defhash must match this pattern.
329
330 Examples:
331
332 Example #1.
333
334 "p" =~ re("DefHash::prop_or_attr"); # matches
335
336 Example #2.
337
338 "_" =~ re("DefHash::prop_or_attr"); # matches
339
340 Example #3.
341
342 "prop" =~ re("DefHash::prop_or_attr"); # matches
343
344 Example #4.
345
346 "Prop2" =~ re("DefHash::prop_or_attr"); # matches
347
348 Example #5.
349
350 "prop_" =~ re("DefHash::prop_or_attr"); # matches
351
352 Cannot start with digit.
353
354 "0prop" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
355
356 Invalid character: dash.
357
358 "prop-erty" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
359
360 Invalid character: whitespace.
361
362 "property " =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
363
364 Example #9.
365
366 ".attr" =~ re("DefHash::prop_or_attr"); # matches
367
368 Example #10.
369
370 "._attr" =~ re("DefHash::prop_or_attr"); # matches
371
372 Example #11.
373
374 ".attr1.subattr2" =~ re("DefHash::prop_or_attr"); # matches
375
376 Example #12.
377
378 "prop.attr1" =~ re("DefHash::prop_or_attr"); # matches
379
380 Example #13.
381
382 "_prop._attr1" =~ re("DefHash::prop_or_attr"); # matches
383
384 Example #14.
385
386 "Prop.attr1.subattr2.Subattr3" =~ re("DefHash::prop_or_attr"); # matches
387
388 Example #15.
389
390 "_prop.attr1" =~ re("DefHash::prop_or_attr"); # matches
391
392 Cannot start with digit (1).
393
394 ".0attr" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
395
396 Cannot start with digit (2).
397
398 "prop.0attr" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
399
400 Cannot start with digit (3).
401
402 "prop.attr.0subattr" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
403
404 Invalid character: dash (1).
405
406 ".attr-ibute" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
407
408 Invalid character: dash (2).
409
410 "prop-erty.attribute" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
411
412 Invalid character: dash (3).
413
414 "prop.attr-ibute" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
415
416 Invalid character: whitespace (1).
417
418 "property .attr" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
419
420 Invalid character: whitespace (2).
421
422 "property.attr " =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
423
424 Invalid character: whitespace (3).
425
426 ".attr " =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
427
428 Invalid syntax: dot only.
429
430 "." =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
431
432 Invalid syntax: double dot.
433
434 "..attr" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
435
436 Invalid syntax: dot without attr.
437
438 "attr." =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
439
440 Invalid syntax: dot without attr (2).
441
442 "attr.." =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
443
444 Empty.
445
446 "" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
447
449 Please visit the project's homepage at
450 <https://metacpan.org/release/Regexp-Pattern-DefHash>.
451
453 Source repository is at
454 <https://github.com/perlancar/perl-Regexp-Pattern-DefHash>.
455
457 Please report any bugs or feature requests on the bugtracker website
458 <https://rt.cpan.org/Public/Dist/Display.html?Name=Regexp-Pattern-DefHash>
459
460 When submitting a bug or request, please include a test-file or a patch
461 to an existing test-file that illustrates the bug or desired feature.
462
464 DefHash specification.
465
466 Regexp::Pattern
467
468 Some utilities related to Regexp::Pattern: App::RegexpPatternUtils,
469 rpgrep from App::rpgrep.
470
472 perlancar <perlancar@cpan.org>
473
475 This software is copyright (c) 2021 by perlancar@cpan.org.
476
477 This is free software; you can redistribute it and/or modify it under
478 the same terms as the Perl 5 programming language system itself.
479
480
481
482perl v5.34.0 2022-01-21 Regexp::Pattern::DefHash(3)