[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: Roger
Subject: Re: How to match regex in bash? (any character)
Date: Mon, 26 Sep 2011 19:06:30 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

> On Mon, Sep 26, 2011 at 08:19:27PM -0500, Peng Yu wrote:
>I know that I should use =~ to match regex (bash version 4).
>However, the man page is not very clear. I don't find how to match
>(matching any single character). For example, the following regex
>doesn't match xxxxtxt. Does anybody know how to match any character
>(should be '.' in perl) in bash.
>[[ "$1" =~ "xxx.txt" ]]

Some good reading I found is under the Bash Manual Page section "Parameter

>From here, to learn more about regex/regexpr as the Bash Manual is quite brief
on regex, use the following manual pages:

perlretut - Gives a good from the start explanation of regular expressions,
including perl

perlrequick - If you already know some perl, then just a quick start should do.

There's a lot of Perl Manual Pages and 'man perltoc' will get you a full
listing of manual pages including descriptions.  (I'm currently reading the
perlretut man page as I do not know much perl language at all!)

Is it possible to get more documentation or examples into the Bash Manual
concerning regex.  Maybe some references to the above manual pages or are we
talking severe conflict of interest?  At the very least, one or two common Bash
Parameter examples would be nice!


reply via email to

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