[html-formfu] Filter::TrimEdges - Just Curious

Carl Franks fireartist at gmail.com
Wed Feb 11 09:17:06 GMT 2009


2009/2/11 Dermot <paikkos at googlemail.com>:
> Hi,
>
> Sorry if I am being a bore but I was curious, TrimEdges uses "$val =~
> s/\s+\z//;" to remove white-space from the end of a string. I can't
> find a character class for \z. How does \z differ from $?

Don't be afraid to ask! :)

\z isn't a character class: it's an anchor, and makes sure we're
really at the end of the string.
$ can match before a newline at the end of the string - which isn't
usually what we want.

According to `perldoc perlre`...
$	Match the end of the line (or before newline at the end)
\z	Match only at end of string

Cheers,
Carl



More information about the HTML-FormFu mailing list