today i'm writing some perl code involving regex. I wanted to find out
exactly what is /s (whitespace) is defined. So i did "perldoc -t
perlre".
(from perlre)
NAME
perlre - Perl regular expressions
DESCRIPTION
This page describes the syntax of regular expressions in Perl.
.....
s Treat string as single line. That is, change "." to match any
character whatsoever, even a newline, which normally it would not
match.
The "/s" and "/m" modifiers both override the $* setting. That is,
no matter what $* contains, "/s" without "/m" will force "^" to
match only at the beginning of the string and "$" to match only at
the end (or just before a newline at the end) of the string.
Together, as /ms, they let the "." match any character whatsoever,
while still allowing "^" and "$" to match, respectively, just
after and just before newlines within the string.
.....
In addition, Perl defines the following:
\w Match a "word" character (alphanumeric plus "_") \W Match a
non-"word" character
\s Match a whitespace character
\S Match a non-whitespace character
\d Match a digit character
\D Match a non-digit character
\pP Match P, named property. Use \p{Prop} for longer names. \PP
Match non-P
\X Match eXtended Unicode "combining character sequence",
equivalent to (?:\PM\pM*)
\C Match a single C char (octet) even under Unicode.
NOTE: breaks up characters into their UTF-8 bytes, so you may
end up with malformed pieces of UTF-8. Unsupported in
lookbehind.
(end quote of perlre)
Fucking no mention of it. **** Perl and **** Perl coders.
Yes, there is
Both ways (/s and \s)
HTH
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL.
http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
The older a man gets, the farther he had to walk to school as a
boy.