help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regexp for marking source code


From: Dieter Wilhelm
Subject: Re: Regexp for marking source code
Date: Mon, 14 Aug 2006 23:13:56 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

David Kastrup <dak@gnu.org> writes:

> Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
>
>> David Kastrup <dak@gnu.org> writes:
>>
>>> Ken Goldman <kgold@watson.ibm.com> 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




reply via email to

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