sysctl with regex?

Dag-Erling Smørgrav des at des.no
Wed Feb 10 18:42:33 UTC 2010


Garrett Cooper <yanefbsd at gmail.com> writes:
> Dag-Erling Smørgrav <des at des.no> 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?

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).

> > as in a regular expression.  The glob pattern syntax has no equivalent
> > for +, ?, {m,n}, (foo|bar), etc.
>
> +, {}, and () -- no... that's typically an extension to shell expanded
> values (IIRC). ?

I can't make sense of this - I'm not sure whether you misunderstood what
I wrote, or just failed to express yourself clearly...

> > 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.

No, but you claimed that .+ is not non-greedy, which is incorrect.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-hackers mailing list