bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] Regular expression matching


From: Ángel González
Subject: Re: [Bug-wget] Regular expression matching
Date: Thu, 05 Apr 2012 22:31:28 +0200
User-agent: Thunderbird

On 05/04/12 20:18, Micah Cowan wrote:
> On 04/04/2012 12:02 PM, Ángel González wrote:
>> I really like PCRE, but I think the default should be POSIX regex
>> (those you called "gnulib regex library"), just as every other
>> command lines tool, such as sed or grep. There could be a
>> --perl-regexp switch to change it (which could take advantage of the
>> posix interface of pcre). 
> sed and grep's default regexes (BREs) are next-to-useless, and are only
> used by default for historical compatibility. They manage to be useful
> much of the time for grep, but sed is greatly hampered - it's somewhat
> improved by GNU extensions to the POSIX BRE syntax, which become hard to
> live without when you try to use sed on a system that lacks them. EREs
> (what you get with "grep -E" or "egrep") are a big step up, and are
> still POSIX, so that's what I'd recommend as a default.
>
> OTOH, PCREs are completely compatible with well-formed EREs, in which
> case there seems little harm in letting those be default. But it would
> be nice to fall back onto POSIX regexes when PCRE is not found.
>
> There should be information added to the --version output, to declare
> the presence of regex support, and what types are supported.
I'm a bit afraid of "this command doesn't work here, but worked in this
other system", because they are compiled with different types of regex.

Requiring an explicit type of regex (which could be set in .wgetrc)
provides
a clear error.

> Also, I think regex type selection should be with something like
> --regex-type=pcre, rather than something like --perl-regexp, to allow
> for easy expansion if need be.
That's fine for me. in fact, I had considered something like
--match-type=shell|posix|pcre...

--perl-regexp is the name of the option in grep.







reply via email to

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