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