GNU bug report logs - #5970
regex won't do lazy matching

Previous Next

Package: coreutils;

Reported by: a g <mewalig <at> gmail.com>

Date: Mon, 19 Apr 2010 02:02:01 UTC

Severity: normal

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 5970 <at> debbugs.gnu.org (full text, mbox):

From: "Alan Curry" <pacman-cu <at> kosh.dhis.org>
To: mewalig <at> gmail.com (a g)
Cc: 5970 <at> debbugs.gnu.org
Subject: Re: bug#5970: regex won't do lazy matching
Date: Mon, 19 Apr 2010 16:56:33 -0500 (GMT+5)
a g writes:
> 
> This may be a usage problem, but it does not exist with other regex packages
> (such as slre) and I can't find anything in the documentation to indicate
> that the syntax should be different for coreutils. I am using coreutils 8.4
> on ubuntu AMD64, version 9.10. I cannot get the coreutils regex matcher to
> do lazy matching. Here is my code:

By "lazy" do you mean non-greedy?

> Here is the problem. If you execute:
>   regex_test "a[^x]*?a" "a1a2a"

The non-greedy quantifiers like *? are not part of standard regex, they are
extensions found in perl, and in other packages inspired by perl.

-- 
Alan Curry




This bug report was last modified 15 years and 24 days ago.

Previous Next


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