Abstract
Perl 6 offers great tools for composing regexes, thus making them reusable. This inspires programmers to carefully organize and test their regexes, just like regular code.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Perl 6 has a built-in type called byte , so if you leave out the ampersand, you’ll accidentally reference this type instead.
- 2.
In Python, it’s even more complicated, since whitespace at the start of a line is significant, except when it’s inside an expression.
- 3.
The assertion <!ww> matches every exception within a word.
- 4.
Remember that the leading dot in <.ws> causes the regex not to capture. Since the ws routine is all about whitespace that we don’t particularly care about, not capturing its match makes sense.
- 5.
- 6.
- 7.
- 8.
- 9.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2017 Moritz Lenz
About this chapter
Cite this chapter
Lenz, M. (2017). Reusing and Composing Regexes. In: Parsing with Perl 6 Regexes and Grammars. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3228-6_8
Download citation
DOI: https://doi.org/10.1007/978-1-4842-3228-6_8
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-3227-9
Online ISBN: 978-1-4842-3228-6
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books