From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 10 23:40:59 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 633A01065731 for ; Wed, 10 Feb 2010 23:40:59 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-yx0-f172.google.com (mail-yx0-f172.google.com [209.85.210.172]) by mx1.freebsd.org (Postfix) with ESMTP id E12768FC14 for ; Wed, 10 Feb 2010 23:40:58 +0000 (UTC) Received: by yxe2 with SMTP id 2so453147yxe.7 for ; Wed, 10 Feb 2010 15:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to:x-mailer; bh=CLOEuhbWpgrpVlF6/BZ8hpw1AF36MZyGXjDhwvnE5OU=; b=i1HPsAEMotUSNZ/K3j6byjZe8b1gm8TAt9K/+mdn4ledVWjjWzbjZEp5NpX6RXG+vd lGCWU3RBUoKMb8sgSkXy8Np93k3bYApbdbSR37kZuOlswc0aHXORLj1n6Nz0ZJ/9tVpv dVcmuWnDFb7ZPdu0OIFYjNhk3hVPKyPn1jh/E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=XAKH1zcnQOSJfwbGKrgjHGUMvrDMKfycWopnPrlqX7o+YD9C998j7zY+jR4i4VcvxQ 7rMAWE16n+inOkdcOr9SqOo1ptG5YzvxM5ViDeYO+bj9dmDm/ZyS23FNAwLk+MLNpEvd r2ueQN7Pv2lgC4zEZXplL/5GWPPEvo1/drz60= Received: by 10.100.54.5 with SMTP id c5mr1348706ana.188.1265845257835; Wed, 10 Feb 2010 15:40:57 -0800 (PST) Received: from dhcp-173-37-1-163.cisco.com (nat.ironport.com [63.251.108.100]) by mx.google.com with ESMTPS id 15sm1192562gxk.8.2010.02.10.15.40.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Feb 2010 15:40:56 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=iso-8859-1 From: Garrett Cooper In-Reply-To: <868wb1hqzs.fsf@ds4.des.no> Date: Wed, 10 Feb 2010 15:40:54 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <44741B44-5EDA-4DDE-8C92-B74465BCA670@gmail.com> References: <86tytqvwky.fsf@ds4.des.no> <26049703-8844-4476-B277-776A4EFC0A53@gmail.com> <86fx59jpti.fsf@ds4.des.no> <7d6fde3d1002100923i6bbc24a7ocaf408f4d78ec59f@mail.gmail.com> <868wb1hqzs.fsf@ds4.des.no> To: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= X-Mailer: Apple Mail (2.1077) Cc: Andrew Brampton , freebsd-hackers@freebsd.org Subject: Re: sysctl with regex? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Feb 2010 23:40:59 -0000 On Feb 10, 2010, at 10:42 AM, Dag-Erling Sm=F8rgrav wrote: > Garrett Cooper writes: >> Dag-Erling Sm=F8rgrav writes: >>> A glob pattern can be trivially translated to a regular expression, = but >>> not the other way around. Basically, * in a glob pattern = corresponds to >>> [^/]*, ? corresponds to ., and [abcd] and [^abcd] have the same = meaning >> ^^^^ ???? ^^^^ >> The former is a positive assertion, where the latter is a negative >> assertion -- how can they have the same meaning? >=20 > Read the entire sentence. BTW, neither of these are assertions, and > neither of these is negative in any sense, they are just different = ways > of selecting characters from the alphabet (in the extended sense). Yes, I mentally omitted the second half because of the sentence = construction. Sorry ><. >>> as in a regular expression. The glob pattern syntax has no = equivalent >>> for +, ?, {m,n}, (foo|bar), etc. >>=20 >> +, {}, and () -- no... that's typically an extension to shell = expanded >> values (IIRC). ? >=20 > I can't make sense of this - I'm not sure whether you misunderstood = what > I wrote, or just failed to express yourself clearly... Ok -- redo: +, {} and () aren't typical shell glob operators. They're = typically extensions in certain shells (bash for instance). >>> Finally, .* and .+ are *both* greedy. Perl's regular expression = syntax >>> includes non-greedy variants for both (.*? and .+? respectively). >> Yes, but I didn't explicitly note those forms. >=20 > No, but you claimed that .+ is not non-greedy, which is incorrect. Yes. My previous understanding was incorrect. Thanks for the = clarification :). Cheers, -Garrett=