[Top][All Lists]

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

Re: Question about some fields in regex's re_pattern_buffer

From: Reuben Thomas
Subject: Re: Question about some fields in regex's re_pattern_buffer
Date: Fri, 30 Jul 2010 19:35:29 +0100

On 30 July 2010 13:06, Paolo Bonzini <address@hidden> wrote:
> A chapter maybe.  But Bruno is the doc guru.

Thanks. While waiting for Bruno to say what he'd like, one more
question: in regex.h there's the documentation:

/* If this bit is set, then anchors do not match at newline
     characters in the string.
   If not set, then anchors do match at newlines.  */
#define REG_NEWLINE (REG_ICASE << 1)

This seems to be the wrong way around; info libc says:

     Treat a newline in STRING as dividing STRING into multiple lines,
     so that `$' can match before the newline and `^' can match after.

Also, elsewhere in regex.h we have:

  /* If true, an anchor at a newline matches.  */
  unsigned __REPB_PREFIX(newline_anchor) : 1;

and in the code, newline_anchor is set to true iff REG_NEWLINE is in
cflags (in regcomp):

  /* If REG_NEWLINE is set, newlines are treated differently.  */
  if (cflags & REG_NEWLINE)
    { /* some code omitted */
      preg->newline_anchor = 1;
    preg->newline_anchor = 0;

So am I right in concluding that the comment for REG_NEWLINE in
regex.h is the wrong way around?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]