From owner-freebsd-questions@FreeBSD.ORG Wed Jan 17 02:42:05 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D47A516A40F for ; Wed, 17 Jan 2007 02:42:05 +0000 (UTC) (envelope-from baka.rob@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by mx1.freebsd.org (Postfix) with ESMTP id 6DBAC13C46A for ; Wed, 17 Jan 2007 02:42:05 +0000 (UTC) (envelope-from baka.rob@gmail.com) Received: by ug-out-1314.google.com with SMTP id o2so1709865uge for ; Tue, 16 Jan 2007 18:42:04 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=hff9+JV6oksLrFsDOFmv+EPokzjsWYCbCWVBCFCwD70GV84C7cp6pegLk/Xa9ZKhz4SyM48DOZGKq/KZBKLR1PrcZm4UxrnODTMixRSoiR96QIEN2MwfeVt64wKA9pC/Q3NE+RpCy9YSCS6lVhYWU91HBwGTMt9lDOpPGKHgrdQ= Received: by 10.82.152.16 with SMTP id z16mr1404676bud.1169000134795; Tue, 16 Jan 2007 18:15:34 -0800 (PST) Received: by 10.82.117.19 with HTTP; Tue, 16 Jan 2007 18:15:34 -0800 (PST) Message-ID: Date: Tue, 16 Jan 2007 20:15:34 -0600 From: "Parker Anderson" To: "applecom@inbox.ru" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Cc: freebsd-questions@freebsd.org Subject: Re: regexp [. .] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jan 2007 02:42:05 -0000 On 1/16/07, applecom@inbox.ru wrote: > I need to use regular expressions with a sequence of characters as a > collating element. > From re_format(7): > "Within a bracket expression, a collating element (a character, a multi- > character sequence that collates as if it were a single character, or a > collating-sequence name for either) enclosed in `[.' and `.]' stands for > the sequence of characters of that collating element. The sequence is a > single element of the bracket expression's list. A bracket expression > containing a multi-character collating element can thus match more than > one character, e.g. if the collating sequence includes a `ch' collating > element, then the RE `[[.ch.]]*c' matches the first five characters of > `chchcc'." > But grep (and other programs using regexp) writes on "echo somepattern | > grep -Ee 'some[^[.pattern.]]'": > "Invalid collation character". What's wrong? After some searching around I found the following post (albeit for a different project): http://permalink.gmane.org/gmane.comp.gnu.utils.bugs/11462 An excerpt: " I have to admit to having no experience with collating characters. That said, I'll convey my understanding of them. You cannot use [. and .] to group an arbitrary pair of characters together. Collating characters are defined by the locale in which you're running, and only those defined by the locale are available for use inside [. and .]. They usually have names, defined by the locale; the name may or may not be the actual sequence of characters, such [as] '[.ch.].' " I'm not sure, myself, but I hope that helps and isn't far from the truth ;) If anyone knows otherwise, please let me know. Is there a certain match you are trying to pattern? From the looks of it, [ch]* would match a similar set of characters, but it isn't as strict about which pattern they should be in. Sincerely, -Parker