Date: Wed, 10 Feb 2010 00:45:30 +0000 From: Andrew Brampton <brampton+freebsd@gmail.com> To: Garrett Cooper <yanefbsd@gmail.com> Cc: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= <des@des.no>, freebsd-hackers@freebsd.org Subject: Re: sysctl with regex? Message-ID: <d41814901002091645w289aa894q4a06cbaed59eea05@mail.gmail.com> In-Reply-To: <26049703-8844-4476-B277-776A4EFC0A53@gmail.com> References: <d41814901002091308s7e894b55p880bde165bbbe703@mail.gmail.com> <86tytqvwky.fsf@ds4.des.no> <d41814901002091528i4884987cmb7347dfe4d50bdc5@mail.gmail.com> <26049703-8844-4476-B277-776A4EFC0A53@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 10, 2010 at 12:14 AM, Garrett Cooper <yanefbsd@gmail.com> wrote= : > C-shell globs as some programming languages referring to it as, i.e. perl= (which this is a subset of the globs concept) allow for expansion via `*' = to be `anything'. Regexp style globs for what you're looking for would be e= ither .* (greedy) or .+ (non-greedy), with it being most likely the latter = case. > Ah I understand the difference now. Thanks. > =C2=A0 =C2=A0 =C2=A0 =C2=A0I'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 glob= s or regular expressions? There are pluses and minuses to each version and = would require some degree of parsing (and potentially escaping). I think going for the simpler glob option might be best. In my earlier example a regex would have problems with all the periods, would it not? Also if I want to match anything I would always forget to write .* instead of just * I was just having a quick look at how to implement this, would it be best to use the fnmatch function? Having a quick browse of the FreeBSD source I found csh_match in /usr.sbin/pkg_install/lib/match.c:L456 which seems to do something similar to what we want. BTW Feel free to implement this, I was going to have a go but I doubt I'd actually get around to it :( Andrew
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d41814901002091645w289aa894q4a06cbaed59eea05>