Wouldn’t it be great if books had embedded videos? That would make programming textbooks so much easier.
We have to give some hints about how regexes work in the first regex chapter in Learning Perl. It’s hard to describe something like greedy matching and backtracking with only words. It seems like it should be simple to describe, but you are probably like me: you think that because you already understand those concepts. Continue reading “Watch regexes with Regexp::Debugger”
Character class shortcuts used to be easy because ASCII was easy. Either of those were easy if ASCII was what you wanted, but quite limiting otherwise. Perl v5.6 introduced Unicode support and the world started to change.
A good programmer is always trying to eliminate ambiguity. Their code should work the same way everywhere, but character class shortcuts can’t guarantee that anymore. I wrote about these a bit in Know your character classes for The Effective Perler.
A student in my Learning Perl class asked about what shows up in a capture when you apply a quantifier to that group. The great thing about computer programming is that you can just try it to find out: Continue reading “Captures with quantifiers match the last captured substring”
Perl 5.18 added vertical tab (or LINE TABULATION in the UCS) to the characters that match the
\s character class shortcut. It’s the one exception that made that shortcut different from the POSIX definition of whitespace. For the details, see my posts in The Effective Perler: The vertical tab is part of \s in Perl 5.18. Continue reading “The vertical tab now matches \s”