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.
- JSON Value
- Select Sales
- Token Byte
- Item Value
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
This is a preview of subscription content, access via your institution.
Perl 6 has a built-in type called byte , so if you leave out the ampersand, you’ll accidentally reference this type instead.
In Python, it’s even more complicated, since whitespace at the start of a line is significant, except when it’s inside an expression.
The assertion <!ww> matches every exception within a word.
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.
Rights and permissions
© 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
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