From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 985 invoked by alias); 2 Jul 2013 01:37:43 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17848 Received: (qmail 11947 invoked from network); 2 Jul 2013 01:37:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at macports.org does not designate permitted sender hosts) X-AuditID: 12074412-b7f656d00000102f-4b-51d22d31ee2d Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: input foo, output '[F|f][O|o][O|o]'? From: =?iso-8859-1?Q?Lawrence_Vel=E1zquez?= In-Reply-To: Date: Mon, 1 Jul 2013 21:30:22 -0400 Cc: "zsh-users@zsh.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <694051372704284@web26e.yandex.ru> To: TJ Luoma X-Mailer: Apple Mail (2.1508) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrAIsWRmVeSWpSXmKPExsUixO6iqGuoeynQoG+2msXOXbwWO06uZHRg 8tg56y67x6qDH5gCmKK4bZISS8qCM9Pz9O0SuDM+X/zGUrCFp+LdlltsDYwLObsYOTkkBEwk 9hy6wghhi0lcuLeerYuRi0NI4DKjxIu7HxkhnHNMEuder2UDqWIW0JK48e8lE4jNK6AnsfTf HLBuYQFDiRezPzOD2GwCjhJPj85kAbE5BWwlZn74yA5iswioSCx/8x7I5gCaoy1x9G8hxEht iWULXzNDjLSXOLB4H1irkEC8xIo118BsEQF5iT+X/rKCtEoIyErs/J00gVFgFpKDZiE5aBaS qQsYmVcxyiXmlObq5iZm5hSnJusWJyfm5aUW6Zrp5WaW6KWmlG5ihISp0A7G9SflDjEKcDAq 8fAqzLsYKMSaWFZcmXuIUZKDSUmU95HmpUAhvqT8lMqMxOKM+KLSnNTiQ4wSHMxKIrw3vYHK eVMSK6tSi/JhUtIcLErivD8Xq/sJCaQnlqRmp6YWpBbBZGU4OJQkeAN0gIYKFqWmp1akZeaU IKSZODhBBBfIBh6gDWEghbzFBYm5xZnpEEWnGBWlxHnbQRICIImM0jy4AbCE8opRHOgfYd5Y kCoeYDKC634FNJgJaDBv6zmQwSWJCCmpBkab0MSwC4t7zP80Bj25ebzoiPz3XVp3tgRyZMby nln2nvnioQMeHDHTDRrN8i/49F3W3h4Qqs70vzxrh9S5K9NFe9lF8i+p/fWb8GTSFpczn/7v lv0mxcmXXJ+W4dfNtvijwYH9P2XyT/2PNsk1NVvpqxUYO2XP61MzVy6x+BH5yzWEMTklYYcS S3FGoqEWc1FxIgDRu41vAwMAAA== On Jul 1, 2013, at 8:58 PM, TJ Luoma wrote: > On 1 Jul 2013, at 14:44, ZyX wrote: >=20 >> By the way, what regex engine is your output for? Any I am aware of = parse "[N|n]" as "either one of three characters: N, n, or pipe". >=20 > Really? I can think of several that support it. Maybe it's because I'm = old enough to remember when a lot of these utilities didn't have 'ignore = case' >=20 > % echo "foo\nbar\nbat" | egrep -v '[F|f]' > bar > bat >=20 > % echo "foo\nbar\nbat" | sed 's#[F|f][O|o][O|o]#XXX#g' > XXX > bar > bat These regex are not matching what you think they are matching. For sure, = "[F|f]" matches both lowercase and uppercase F, but as ZyX said, it also = matches pipe characters: % echo "foo\nbar\nbaz\nbar|||baz" | egrep -v '[F|f]' bar baz % echo "foo\nbar\nbaz\nbar|||baz" | sed 's/[F|f][O|o][O|o]/XXX/g' XXX bar baz barXXXbaz You are probably thinking of "(F|f)"; you should just use "[Ff]". > You can also use it for matching case/esac : >=20 > case "$i" in > [C|c][R|r][A|a][S|s][H|h][P|p][L|l][A|a][N|n]) > echo "matched crashplan" > ;; >=20 > *) > echo "No Match" > ;; >=20 > esac Same misconception here; pipes in patterns' bracket expressions have no = special meaning. You can remove all the pipes from your example, and it = would still work. % case "crasHPLan" in case> [Cc][Rr][Aa][Ss][Hh][Pp][Ll][Aa][Nn]) echo = "matched";; case> *) echo "did not match";; case> esac matched vq=