Re: [dwm] regex

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Sun, 3 Dec 2006 11:21:00 +0100

On Sat, Dec 02, 2006 at 07:00:51PM +0100, Manuel Badzong wrote:
> Hi
>
> I just tried to apply tags to programs (classes) using rules[] in
> config.h. Is there any reason why all the supplied configs use patterns
> like "Firefox.*", which is more complex as just "Firefox" but results
> exactly the same (in a regex point of view)?
>
> As I tried to apply multiple Tags to one class I found out that dwm is
> using traditional regexes. This is not really bad, but if I want to use
> something like (IMO this is the only useful way to use the tag regexes):
>
> "\(net\|dev\)"
>
> The correct config.h regex is:
>
> "\\(net\\|dev\\)"
> (The backslash is a compiler escape)
>
> This works fine (in a regex point of view, not yet in dwm's) but to
> ease things I would propose to use extended regexes, to make it work
> like:
>
> "(net|dev)"
>
> Which is definitely more readable.
>
> But yet dwm is not able to apply multiple tags to a class because it
> stops checking the classes after the first match. If this is the
> desired behavior, regexes for the tags are useless and strcmp should
> be used instead.
>
> Here's my patch for 2.5.

Stupid error of me (the !matched). Agreed, applied in hg tip.

Regards,

-- 
 Anselm R. Garbe >< http://suckless.org/~arg/ >< GPG key: 0D73F361
Received on Sun Dec 03 2006 - 11:21:00 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:33:21 UTC