Re: Word boundaries in regexps (Apache bug?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 15 Sep 2009, Nick Kew wrote:
> > /\\bcity\\b/ works on my localhost (Debian Linux with Apache
> > 2.2.13-1),
>
> Good.  Mystery solved (though I have to confess I'm a little
> surprised you need that in the context).

Here is the piece of code that (I believe) eats the backslashes (mod_include.c:
get_ptoken()). token->value is the start of the string, p the end. shift is
the number of unescaped backslashes found in the string.

        apr_size_t len = p - token->value - shift;
        char *c = apr_palloc(ctx->dpool, len + 1);

        p = token->value;
        token->value = c;

        while (shift--) {
            const char *e = ap_strchr_c(p, '\\');  /* move e to the next backslash */

            memcpy(c, p, e-p);                     /* copy up to the backslash excluding it */
            c   += e-p;                            /* now c points to the end of the destination string */
            *c++ = *++e;                           /* copy there the char that comes *after* the '\' and forget about the '\' */
            len -= e-p;
            p    = e+1;
        }

        if (len) {
            memcpy(c, p, len);
        }
        c[len] = '\0';

Torsten

-- 
Need professional mod_perl support?
Just hire me: torsten.foertsch@xxxxxxx

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux