bug-bash
[Top][All Lists]
Advanced

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

Re: How to match regex in bash? (any character)


From: Roger
Subject: Re: How to match regex in bash? (any character)
Date: Thu, 29 Sep 2011 13:52:53 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

> On Thu, Sep 29, 2011 at 12:06:08PM -0400, Chet Ramey wrote:
>On 9/29/11 11:59 AM, Peng Yu wrote:
>> On Thu, Sep 29, 2011 at 10:38 AM, Chet Ramey <chet.ramey@case.edu> wrote:
>>> On 9/29/11 9:48 AM, Peng Yu wrote:
>>>
>>>> Therefore, either bash manpage should specify clearly which regex
>>>> manpage it should be in each system (which a bad choice, because there
>>>> can be a large number of systems), or the bash manpage should omit all
>>>> the non consistent reference and say something like "see more details
>>>> in info" or something else that is platform independent. Referring to
>>>> regex(3) without any quantification is not a very good choice .
>>>
>>> Why, exactly?  regex(3) is the one thing that's portable across systems,
>>> it happens to describe the interfaces bash uses, and it contains the
>>> appropriate system-specific references.  `info' is considerably less
>>> portable and widespread than `man', so a man page reference is the best
>>> choice.
>> 
>> We all have discovered that regex(3) is not consistent across all the
>> platform. Why you say it is portable?
>
>That is not what we discovered.  We discovered that the name and section of
>the man page describing regular expression formats differs across systems.
>We also discovered that every system we checked (at least every system I
>checked) has a regex(3) man page, and that in most cases that page
>(regex(3)) eventually contains the appropriate system-specific reference
>to the page that describes the regular expression format.  That is why it
>is the most portable alternative.

Since you're saying the regex description is found within either regex(3) or
regex(7), couldn't there be a brief note within the Bash Manual Page be 
something
to the effect:

"For a description of regex, an unfortunate variable location depending on
system, see either regex(3) or regex(7)."

Bash Manual Page shows few manual pages within the "See Also" section, while
omitting regex(3)/(7) entirely within the "See Also" section.  And, to also
note, there's only *one* mention of regex (ie. regex(3)) within the Bash Manual
Page.

Checking the Grep Manual Page, it shows many additional manual pages for
"Regular Expressions".  (Info overload really according to what Greg has stated
about about ERE's.  Either the ERE's website URL or regex (7) is all that is 
needed.)

Or, adding a "Regular Expression" title under See Also section and pointing to
regex(3), regex(7) or ERE URL?

(For my use, I've got regex(7) and the ERE xbd_chap09 on my E-Book reader for
reference, with preference towards the xbd_chap09 print-to-pdf HTML page.)


As you stated, I'm only seeing "regex(3)" listed within the Bash Manual,
leaving the reader to try to ascertain, is the description really within
regex(3), or is it a little deeper such as regex(7)?  On initial inspection of
regex(3) by a beginner, they're going to be overwhelmed as regex(3) deals
entirely with the C programming language!  A non-programmer will just fail at
locating regex(7) as they'll be too overwhelmed.  A programmer might realize
the regex(3) isn't a real description and will kind of know that they're
misled and should/might look at regex(7).

Many entry level programmers likely use Bash, before moving on to C/C++, etc.

-- 
Roger
http://rogerx.freeshell.org/



reply via email to

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