Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Feb 2010 16:47:56 -0800
From:      Garrett Cooper <yanefbsd@gmail.com>
To:        David Wolfskill <david@catwhisker.org>
Cc:        hackers@freebsd.org
Subject:   Re: sysctl with regex?
Message-ID:  <6A6276EA-27D4-4BC2-A4A9-EFF190D3EB10@gmail.com>
In-Reply-To: <20100210001937.GU391@bunrab.catwhisker.org>
References:  <d41814901002091308s7e894b55p880bde165bbbe703@mail.gmail.com> <86tytqvwky.fsf@ds4.des.no> <d41814901002091528i4884987cmb7347dfe4d50bdc5@mail.gmail.com> <26049703-8844-4476-B277-776A4EFC0A53@gmail.com> <20100210001937.GU391@bunrab.catwhisker.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Feb 9, 2010, at 4:19 PM, David Wolfskill wrote:

> On Tue, Feb 09, 2010 at 04:14:12PM -0800, Garrett Cooper wrote:
>> ...
>> 	I'll see if I can whip up a quick patch in the next day or so -- =
but before I do that, does it make more sense to do globs or regular =
expressions? There are pluses and minuses to each version and would =
require some degree of parsing (and potentially escaping).
>> ...
>=20
> I believe it's easier to be precise about exactly what is wanted with =
a
> regex (vs. a glob).
>=20
> On the other hand, globs tend to be "quick & dirty" (in my =
experience).  ;-}

	Your doppleganger's Andrew :o?
	Regexps have a certain degree of ambiguity with them, as the =
following is a valid regexp:

sysctl dev\.cpu\..*\.temperature

	Assuming the correct periods are escaped, this would be a minor =
bug-prone task to complete.
	Whereas this form will return different results from what you =
want most likely (note the subtle difference with the extra period):

sysctl dev\.cpu.*\.temperature

	Globs in this case don't buy you that much difference for what =
you want, and (IMO) add unnecessary complexity to the problem as you can =
still apply basic character classes, et all.
Thanks,
-Garrett=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6A6276EA-27D4-4BC2-A4A9-EFF190D3EB10>