Gordon Messmer <[EMAIL PROTECTED]> writes:

[...]

>> 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.
>
> Your misunderstanding of a regex match does not constitute a weakness in
> find. :)

Yikes... looks like there's been plenty of that.. (my misunderstanding) 

>> In the context of the original post, the comparison was to perl regex.
>
> Perl searches for a regex in a string, rather than matching a pattern on
> a string.

I disagree, and I think this is the hub of the matter.  Regex always
match a pattern.  That is what regex do.  One may search with a regex,
true enough but the regex always matches a pattern.

What is happening with find is that part of the pattern is predefined.
Thereby removing some of the versatility of regex matching.  That is,
not allowing the operator to choose the match, but predefining it to
some degree.  The operator can chose within whats left.

That is, by definition, less versatile.  Which is really all I meant
by `weaker'.

> 'a+ardvark' doesn't match the full path to ./aardvark which is clearly
> required, as noted by the man page.

Noted by man page or not, it is none the less a limitation on regex
usage.

> > Far as I know there is no stipulation on a regex to match in any
> > special way.
> 
> That's sorta up to the tool that provides the regex match/search.  It's
> not uncommon to differentiate between a search and a match.

Since you've pointed to man 7 regex as the authority on regex, can you
find this distinction explained there?

The distinction was invented in this thread.  I don't think you will
find mention of it in the documentation you point to:


Quoting here, but not to support the above comments:

   DESCRIPTION
          Regular expressions (``RE''s), as defined in POSIX 1003.2,
          come in two forms: modern REs  (roughly  those  of  egrep;
          1003.2  calls  these  ``extended''  REs)  and obsolete REs
          (roughly those of ed(1); 1003.2 ``basic'' REs).   Obsolete
          REs  mostly  exist  for backward compatibility in some old
          programs; they will  be  discussed  at  the  end.   1003.2
          leaves some aspects of RE syntax and semantics open; `(*)'
          marks decisions on these aspects that  may  not  be  fully
          portable to other 1003.2 implementations.

One might conclude from the above that if it doesn't act like egrep or
at least ed.  It isn't posix.

Of course any tool can use regex in any way it sees fit.  The
discussion here was about regex themselves inside find or perl.

My contention has been that the usage in perl, awk egrep is more
powerfull and versatile than that in `find'.  Its not a distinction of
search verses match as you claim.  In all cases matching is how it
works.  Its just that the match is partially defined (ie limited) with
the `find' usage.

And again, not complaining about this -regex addition to find, I think
it is a very nice addtion.  I also think it is really only regex-like.
The real mcCoy has no such limitations.

Full regex would have matched in either of our examples.  Not searched
but matched.  :-)




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

Reply via email to