GNU bug report logs - #1260
regex.c and RE_FRUGAL

Previous Next

Package: emacs;

Reported by: "Alexander V. Lukyanov" <lav <at> netis.ru>

Date: Mon, 27 Oct 2008 16:05:04 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1260 in the body.
You can then email your comments to 1260 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1260; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Alexander V. Lukyanov" <lav <at> netis.ru>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Alexander V. Lukyanov" <lav <at> netis.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: regex.c and RE_FRUGAL
Date: Mon, 27 Oct 2008 18:56:11 +0300
Hello!

This bug report is not quite for emacs, but for its regex library.

It features RE_FRUGAL flag (very useful), but it does not seem to work.

I have tried this rather simple program and it prints 0-12 instead of expected 0-6.

Please advice.

#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "regex.h"
int main()
{
   const char *rexp="<.*?>";
   static struct re_pattern_buffer rexp_c;
   static struct re_registers regs;
   re_syntax_options = RE_FRUGAL;
   re_compile_pattern(rexp,strlen(rexp),&rexp_c);
   if(re_search(&rexp_c,"<html><head>",12,0,12,&regs)==-1) {
      printf("search failed\n");
      return 1;
   }
   printf("%d-%d\n",regs.start[0],regs.end[0]);
   return 0;
}

--
   Alexander.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1260; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Alexander V. Lukyanov" <lav <at> netis.ru>
Cc: 1260 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1260: regex.c and RE_FRUGAL
Date: Tue, 28 Oct 2008 04:17:45 -0400
> This bug report is not quite for emacs, but for its regex library.
> It features RE_FRUGAL flag (very useful), but it does not seem to work.
> I have tried this rather simple program and it prints 0-12 instead of
> expected 0-6.

IIRC you'll need to set RE_NO_POSIX_BACKTRACKING as well, otherwise the
match returned will always be the longest.


        Stefan





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1260; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1260; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Alexander V. Lukyanov" <lav <at> netis.ru>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #20 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Alexander V. Lukyanov" <lav <at> netis.ru>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 1260 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1260: regex.c and RE_FRUGAL
Date: Tue, 28 Oct 2008 14:57:39 +0300
On Tue, Oct 28, 2008 at 04:17:45AM -0400, Stefan Monnier wrote:
> > This bug report is not quite for emacs, but for its regex library.
> > It features RE_FRUGAL flag (very useful), but it does not seem to work.
> > I have tried this rather simple program and it prints 0-12 instead of
> > expected 0-6.
> 
> IIRC you'll need to set RE_NO_POSIX_BACKTRACKING as well, otherwise the
> match returned will always be the longest.

Thank you! The flag RE_NO_POSIX_BACKTRACKING did the trick.

Is there a reason for RE_SYNTAX_EMACS including RE_FRUGAL and not including
RE_NO_POSIX_BACKTRACKING?

-- 
   Alexander.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1260; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Alexander V. Lukyanov" <lav <at> netis.ru>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to "Alexander V. Lukyanov" <lav <at> netis.ru>:
bug acknowledged by developer. Full text and rfc822 format available.

Message #30 received at 1260-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Alexander V. Lukyanov" <lav <at> netis.ru>
Cc: 1260-done <at> debbugs.gnu.org
Subject: Re: bug#1260: regex.c and RE_FRUGAL
Date: Tue, 28 Oct 2008 10:31:29 -0400
>> > This bug report is not quite for emacs, but for its regex library.
>> > It features RE_FRUGAL flag (very useful), but it does not seem to work.
>> > I have tried this rather simple program and it prints 0-12 instead of
>> > expected 0-6.
>> 
>> IIRC you'll need to set RE_NO_POSIX_BACKTRACKING as well, otherwise the
>> match returned will always be the longest.

> Thank you! The flag RE_NO_POSIX_BACKTRACKING did the trick.

> Is there a reason for RE_SYNTAX_EMACS including RE_FRUGAL and not including
> RE_NO_POSIX_BACKTRACKING?

Emacs passes RE_NO_POSIX_BACKTRACKING explicitly depending on whether it
wants posix behavior or not (it has matching functions like
"string-match" and "posix-string-match").


        Stefan




bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Tue, 25 Nov 2008 15:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 303 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.