Re: [R] Parsing regular expressions differently - feature request

From: Wacek Kusnierczyk <>
Date: Sun, 09 Nov 2008 00:37:49 +0100

Wacek Kusnierczyk wrote:

> Duncan Murdoch wrote:
>>>>> Here's a quick hack to achieve the impossible:
>>>> That might solve John's problem, but I doubt it.  As far as I can see
>>>> it won't handle \L, for example.

>>> well, it was not supposed to. it addresses the need for doubling
>>> backslashes when a backslash character is an element of the regex.
>> \L could be an element of a regex in Perl.

you should perhaps specify what you mean by 'could be an element of a regular expression'. there is a difference between a regular expression and a string specifying it.

in /\LA/, i'd say the string between the slashes contains three characters, but the regex contains just one; there is no \L in the regex, and no backslash either.

in /\\LA/, i'd say the string contains four characters, but the regex just three; there is a backslash there, but no \L.

just try qr/\L/ (that's an empty pattern), qr/\LA/ (that's a one-character pattern equivalent to qr/a/), and qr/\\LA/.

in a sense, \L is just a macro used in constructing regexes, but it has no place in a regex. in this view, "\LA" and "a" are two dstinct strings specifying the same regex (try qr/\LA/ eq qr/a/).

vQ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sat 08 Nov 2008 - 23:40:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 09 Nov 2008 - 01:30:23 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive