[Top][All Lists]

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

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

From: rogerx . oss
Subject: Re: How to match regex in bash? (any character)
Date: Sat, 1 Oct 2011 14:39:50 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

> On Thu, Sep 29, 2011 at 11:53:20PM -0800, Roger wrote:
>> On Fri, Sep 30, 2011 at 06:20:32AM +0000, Stephane CHAZELAS wrote:
>>2011-09-29, 13:52(-08), Roger:
>>> 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:
>>No, it's not.
>>I suppose bash could say: See your system regex(3)
>>implementation documentation for the description of extended
>>regular expression syntax on your system. That syntax should be
>>compatible with one version or the other of the POSIX Extended
>>Regular Expression syntax whose specification for the latest
>>version as of writing can be found at:
>>regex(3) points to the API (regex.h), how the system documents
>>the regexps covered by that API is beyond bash knowledge.

I took some time to examine the three regex references:

    Written more like a technical specification of regex.  Great if your're
    going to be modifying the regex code.  Difficult to follow if you're new,
    looking for info.

2) regex(7)
    Although it looks good, upon further examination, I start to see run-on
    sentences.  It's more like a reference, which is what a man file should be.
    At the bottom, "AUTHOR - This page was taken from Henry Spencer's regex

3) grep(1)
    Section "REGULAR EXPRESSIONS".  At about half the size of regex(7), the
    section clearly explains regex and seems to be easily understandable for a
    person new to regex.

I'm thinking, the most people need to know about regex for Bash would be 3 & 2
from the above listing (in order of my preference or readability as the grep
manual was very concise and easy to follow).

And then, learn regex from other books such as;  Sed & (G)AWK book - has an
entire chapter devoted to regex, search/replace functions within Learning the
VI/VIM Editors book, and Grep Pocket Ref. - has three chapters for each  regex,
eregex, and perl regex.  I'm guessing, since the Grep Manual was good, the Grep
Pocket Ref. book will be equally as good.

(I fear buying the "Mastering Regular Expressions" as most say half of the
material within the book is only relevant to Perl.)


reply via email to

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