bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15410: [:alnum:] is not [:alpha:] AND [:digit:]... [:alnum:] is [:al


From: Eric Blake
Subject: bug#15410: [:alnum:] is not [:alpha:] AND [:digit:]... [:alnum:] is [:alpha:] OR [:digit:]
Date: Wed, 18 Sep 2013 14:14:55 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

On 09/18/2013 01:56 PM, Nix wrote:

Please keep the list in the loop:
https://rwmj.wordpress.com/2010/11/08/want-help-dont-email-me-directly/

> The documentation is wrong then...
> When you say "AND" that means you need to satisfy "ALL" entity before it
> exit successfully.
> Using OR is fitted in your description. OR satisfies "ALL" or "EITHER" to
> have a  successful exit.
> 
> Bottom line, it is about the logic of using AND or OR.

It's about WHERE you are using the logic of AND or OR.  Let's try again.
 If I write:

address@hidden:alnum:]!]

then I have a bracket expression containing three elements: [:alnum:],
@, and !, which is the SAME as if I had written the bracket expression

address@hidden:alpha:][:digit:]!]

or even

[[:digit:address@hidden:alpha:]]

Either way, I'm using [:alnum:] as shorthand instead of including both
[:alpha:] AND [:digit:].  Then, the resulting bracket expression matches
one byte that can come from a set of characters: @, !, alpha OR digit.
It is the outer bracket expression that is doing OR matching, while the
inner [:alnum:] element within the bracket expression is representing
AND-based combination shorthand of other possible bracket expression
elements.

Similarly, address@hidden is a bracket expression containing @ AND ! as 
expression
elements, where the overall expression will then match @ OR !.  But as @
matches only one possible character, rather than being shorthand for a
bunch of characters, you don't get as confused by that wording.

If you want to propose a documentation patch to make it clearer for the
next reader, then by all means do so.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]