On Sat, 2002-04-20 at 17:12, Harry Putnam wrote: > > 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.
Find uses the POSIX regex functions in the C library, not some special, weak code. > > 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. man 7 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. Your misunderstanding of a regex match does not constitute a weakness in find. :) > 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. > 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. It doesn't lack any syntax. It *is* the real McCoy. > 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. > For example: > touch aardvark > find . -regex 'a+ardvark' > nothing Do it right: $ find . -regex './a+ardvark' ./aardvark 'a+ardvark' doesn't match the full path to ./aardvark which is clearly required, as noted by the man page. > or > find . -regex 'a*rdvark' > nothing $ find . -regex './a*rdvark' ./aardvark > Or > find . -regex '\(a\)\1rdvark' > nothing $ find . -regex './\(a\)\1rdvark' ./aardvark
signature.asc
Description: This is a digitally signed message part