[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to match pattern in bash?
From: |
Micah Cowan |
Subject: |
Re: How to match pattern in bash? |
Date: |
Wed, 23 Feb 2011 08:07:00 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 |
On 02/23/2011 05:25 AM, Greg Wooledge wrote:
> On Tue, Feb 22, 2011 at 08:03:39PM -0800, Micah Cowan wrote:
>> Bash's special builtin [[ ]] syntax also provides both wildcards, and
>> (much more powerful) extended regexes (roughly similar to Perl regexes;
>> they're what egrep uses).
>
> Just for the record, ERE (Extended Regular Expressions), as used by egrep
> and by bash's [[ =~ operator, are not the same as PCRE (Perl-Compatible
> Regular Expressions).
Right. Mostly you're fine as long as you avoid special backslash
sequences like \s or \w, etc, and the special lookahead or non-grouping
parens (anything that starts "(?" is perl-specific).
--
Micah J. Cowan
http://micah.cowan.name/