From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dieter Wilhelm Newsgroups: gmane.emacs.help Subject: Re: Regexp for marking source code Date: Mon, 14 Aug 2006 23:13:56 +0200 Organization: The Church of Emacs Message-ID: <87bqqnauln.fsf@hans.local.net> References: <44d8c969$1@news.greennet.net> <85slk8xxej.fsf@lola.goethe.zz> <857j1i5cyi.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1155667911 491 80.91.229.2 (15 Aug 2006 18:51:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 15 Aug 2006 18:51:51 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 15 20:51:49 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GD40o-0004YH-N4 for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Aug 2006 20:51:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GD40o-0001fM-4p for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Aug 2006 14:51:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GD40A-0001QY-1j for help-gnu-emacs@gnu.org; Tue, 15 Aug 2006 14:50:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GD407-0001Og-UR for help-gnu-emacs@gnu.org; Tue, 15 Aug 2006 14:50:56 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GD407-0001OR-KZ for help-gnu-emacs@gnu.org; Tue, 15 Aug 2006 14:50:55 -0400 Original-Received: from [212.227.126.171] (helo=moutng.kundenserver.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GD46C-00077w-ER; Tue, 15 Aug 2006 14:57:12 -0400 Original-Received: from [84.167.45.186] (helo=duenenhof-wilhelm.de) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), id 0MKwpI-1GD4023Nly-0003KG; Tue, 15 Aug 2006 20:50:51 +0200 Original-Received: by duenenhof-wilhelm.de (Postfix, from userid 1000) id D9C3676223; Mon, 14 Aug 2006 23:13:56 +0200 (CEST) Original-To: David Kastrup In-Reply-To: <857j1i5cyi.fsf@lola.goethe.zz> (David Kastrup's message of "Wed, 09 Aug 2006 14:08:05 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:d7ab225b98a136e1c2910381f940ecb9 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:36699 Archived-At: David Kastrup writes: > Dieter Wilhelm writes: > >> David Kastrup writes: >> >>> Ken Goldman writes: >>> >>>> The dired Q command seems quite useful, but >>>> regexp syntax is obscure enough that I can't quite >>>> get what I want. >>>> >>>> What would be a regexp for all .c and .h files. >>>> In a Unix shell, it would be *.[ch], What's the >>>> regexp equivalent? >>> >>> .*\.[ch]\' >> >> quick and dirty >> >> \.[ch]$ >> >> since the likely hood of existing hidden files `.h' and `.c' is too >> small for the hassle of typing .* > > That's not it. For matching, .* at the beginning is entirely > useless. If you want to avoid files .c and .h, > .\.[ch]\' You're right, I contradicted myself. > will do the trick. Replacing \' with $ means that you'll also match > multiline file names like > 'x.h > whatever' Never heard of multiline file names, are they really in use? But anyway, this is an instructing example for the `\'' regexp, thanks. > > Probably not important in dired, but I have some healthy matching > paranoia. For example, if some joker creates a file (and its > containing directory) named > '-rf > / > guffaw' > which is infrequently cleaned up by a sysadmin script, things can get > ugly if the script has not been written carefully. hmmm ... rm -rf / guffaw do you mean that rm then erases the root directory recursively? But what is guffaw for? -- Best wishes H. Dieter Wilhelm Darmstadt, Germany