Gordon Messmer <[EMAIL PROTECTED]> writes:

> On Fri, 2002-04-19 at 14:16, Harry Putnam wrote:
>> 
>> I'm not really sure what constitutes a posix legal regex but I don't 
>> think it includes trick riders like having to match a specific part
>> of a string, unless put into the regex itself with anchors or the
>> like.
>
> A regex is a regex, but a regex search is not a regex match.  I don't

Not exactly.  There are several common sets of regex rules.  The one
in find is not as powerfull as what I called the `POSIX' set.

> know that Perl provides both, and if it does I don't recall how they're
> differentiated.  Other applications do.  Python, for instance
> differentiates them thusly:
> http://www.python.org/doc/current/lib/matching-searching.html
>
> Find requires a "match" like Python's, rather than a "search" like perl
> or grep.

Now, I may have used the wrong term (POSIX) and still do not really
know what constitutes a posix legal regex.  However the notation used
with find is weaker in several ways (As I mentioned in my 1st post in
this thread) than what I referred to as POSIX.

In the context of the original post, the comparison was to perl regex.
The usage in find would better be described as regex-like.  Since it
is weaker in several ways, and lacks some of the more powerfull
syntax.  It is a nice addition none-the-less.  I only said it isn't
the real mcCoy.

Far as I know there is no stipulation on a regex to match in any
special way.  Making that stipulation has already weakened the regex
engine involved.

egrep awk and perl  all would give a different (more versatile) result
than that used in find.  Limiting the match in some way only being the
first.

For example:
    touch aardvark
    find . -regex 'a+ardvark'
    nothing

Whereas
    ls|egrep 'a+rdvark'
    aardvark  
works 

or
    find . -regex 'a*rdvark'
    nothing

whereas
 
    ls |egrep 'a*rdvark'
      aardvark   

Using a*rdvark with find -regex fails but with posix regex it is another way
to find something like  aardvark

Or
    find . -regex '\(a\)\1rdvark'
    nothing
or
    find . -regex '(a)\1rdvark'
    find: Invalid back reference

Whereas 

    ls |egrep '(a)\1rdvark'
    aardvark

There are more examples.  But my only point here was that full regex
is more powerfull because it is more versatile.  Not that the usage in
find is a bad thinkg.

The perl script I submitted (barring any scripting errors) would be
more versatile as a result.



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to