in reply to How to match last character of string, even if it happens to be a newline?
My regex Best Practices (lifted whole from TheDamian's Perl Best Practices — highly recommended in general) include using an /xms modifier tail on every qr// m// s/// I write. This reduces the degrees of freedom of the ^ $ . operators and clarifies their function, at least for me. Coupled with the use of \A \z \Z as string start/end anchors, I find I can think a bit more clearly about the highly counterintuitive operation of regular expressions.
Give a man a fish: <%-{-{-{-<
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to match last character of string, even if it happens to be a newline?
by Allasso (Monk) on May 12, 2019 at 15:43 UTC | |
by AnomalousMonk (Archbishop) on May 12, 2019 at 16:56 UTC |
In Section
Seekers of Perl Wisdom