Andrew (via RT) wrote: > > In perlre there is a section entitled "Creating custom RE > engines". The sample code given maps \\ to \ inside regular > expressions and thus prevents you from using \\ to represent a > literal \. I think this is unintentional and a patch is included > below. Good catch. > It might also be useful to put in some explanation as to why the > \\ is required at all as I don't think it is immeadiately clear. > That said I'm not volunteering to do the writing just now :-/ What about : We must also take care of not escaping the legitimate \\Y| sequence, hence the presence of '\\' in the conversion rules. > --- perlre.pod.orig Tue Jan 13 21:46:44 2004 > +++ perlre.pod Sun Jan 23 13:31:26 2005 Thanks, applied to the development docs as change #23872. > @@ -1288,7 +1288,7 @@ > > sub invalid { die "/$_[0]/: invalid escape '\\$_[1]'"} > > - my %rules = ( '\\' => '\\', > + my %rules = ( '\\' => '\\\\', > 'Y|' => qr/(?=\S)(?<!\S)|(?!\S)(?<=\S)/ );Thread Previous