[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: Peng Yu
Subject: Re: How to match regex in bash? (any character)
Date: Thu, 29 Sep 2011 11:18:57 -0500

On Thu, Sep 29, 2011 at 11:06 AM, Greg Wooledge <address@hidden> wrote:
> On Thu, Sep 29, 2011 at 10:59:19AM -0500, Peng Yu wrote:
>> We all have discovered that regex(3) is not consistent across all the
>> platform. Why you say it is portable?
> The three systems I mentioned earlier today all have regex(3).  Which
> system have you found, which doesn't have it?

I think that I misunderstood some of the previous emails.

However, on ubuntu, there is regex(3) and regex(7). Based on the
context in man bash, regex(7) is more relevant than regex(3), although
regex(3) does mention extend regular expression, it is more of a
document for the C interface.

"When it is used, the string to the right of the operator is
considered an extended regular expression and matched accordingly (as
in regex(3))"

Also, regex(3) does not mention the difference between $x =~ xxxx.txt
and $x=~ "xxxx.txt". I think that the difference should be addressed
in man bash.

Bottom line, regex(3) is not a good manpage to refer in the above
sentence. It is better to think of other alternative rather than
trying to justify we should stuck with it.

>> As I mentioned previously, the best is to add a few examples in man
>> bash.
> I would not object to that, but I can't speak for Chet.
> Another option would be to refer to the POSIX definition of
> Extended Regular Expressions as a web site.  I wish they had
> better URLs, though.  The URL I have for it at the moment is
> http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04


reply via email to

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