Re: sysctl with regex?
- From: Garrett Cooper <yanefbsd@xxxxxxxxx>
- Date: Tue, 9 Feb 2010 16:47:56 -0800
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).
...
I believe it's easier to be precise about exactly what is wanted with a
regex (vs. a glob).
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_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- References:
- sysctl with regex?
- From: Andrew Brampton
- Re: sysctl with regex?
- From: Dag-Erling Smørgrav
- Re: sysctl with regex?
- From: Andrew Brampton
- Re: sysctl with regex?
- From: Garrett Cooper
- sysctl with regex?
- Prev by Date: Re: sysctl with regex?
- Next by Date: Re: sysctl with regex?
- Previous by thread: Re: sysctl with regex?
- Next by thread: Re: sysctl with regex?
- Index(es):