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

Re: regular expressions in bash



On Fri, 19 Apr 2002, Harry Putnam wrote:

> Gordon Messmer <yinyang eburg com> writes:
> 
> > On Fri, 2002-04-19 at 07:26, Harry Putnam wrote:
> >> 
> >> It is new within a year or so, I believe but if you look close you'll
> >> also notice it isn't posix regex 
> >> 
> >> The example given shows it.
> >>   `b.*r3
> >> 
> >> Does not match
> >>   ./fubar3
> >
> > Sure it's a POSIX regex.  However, the man page points out that the
> > pattern must *match* the *entire path*.  Match vs. search maybe isn't
> > clear if you're accustomed to always searching... A regex search will
> > match if any part of the string fits the regex.  A "match" is only good
> > if the pattern fits the string from the very beginning.
> 
> 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.

 No, but the find man page actually specifies that it has to match the
whole path, i.e. there is an implicit "^" at the start, as if it were
"^(your_regexp_here)"






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