develooper Front page | perl.perl5.porters | Postings from April 2007

Re: perlrebackslash

Thread Previous | Thread Next
H.Merijn Brand
April 12, 2007 07:18
Re: perlrebackslash
Message ID:
On Thu, 12 Apr 2007 15:23:12 +0200, Abigail <> wrote:

> Following last months document about RE character classes, here's a
> document about the backslash.

Nice reading ...

> =head2 The backslash
> In a regular expression, the backslash can perform one of two tasks:
> it either takes away the special meaning of the character following it
> (for instance, C<\|> matches a vertical bar, it's not an alternation),
> or it is the start of a backslash or escape sequence.
> The rules determining what it is are quite simple: if the character
> following the backslash is a punctuation (non-word) character (that is,
> anything that is not a letter, digit or underscore), then the backslash

  [0-9A-Za-z_], or are unicode letters allowed?

> just takes away the special meaning (if any) of the character following
> it.
> If the character following the backslash is a letter or a digit, then the


> sequence may be special; if so, it's listed below. A few letters have not
> been used yet, and escaping them with a backslash is safe for now, but a
> future version of Perl may assign a special meaning to it. However, if you
> have warnings turned on, Perl will issue a warning if you use such a sequence.
> [1].

/me now is intrigued by what \_ would mean.

pc09:/home/merijn 103 > perl -wle'print"\_"'
pc09:/home/merijn 104 > perl -wle'print qr/\_/'
pc09:/home/merijn 105 >

So, the start of this paragraph should include the underscore?

H.Merijn Brand         Amsterdam Perl Mongers (
using & porting perl 5.6.2, 5.8.x, 5.9.x   on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and Cygwin.  

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About