help - busybox- grep and Source command

Rich Felker dalias at aerifal.cx
Mon Sep 4 21:47:34 UTC 2006


On Mon, Sep 04, 2006 at 08:48:17PM +0200, Juergen Hennerich wrote:
> You have overlooked that I used grep -E. This (might be) limitations 
> only apply to BRE, but I was using ERE. Also I think most 
> implementations support it anyhow.
> 
> For ERE this applies:
> 
> An ERE can be limited to matching strings that begin or end a line; this 
> is called "anchoring". The circumflex and dollar sign special characters 
> shall be considered ERE anchors when used anywhere outside a bracket 
> expression.

OK thanks for the clarification. I just assumed ERE had the same issue
without ever reading it.

> Using BRE makes the expression a little bit more complicated.
> 
> grep '^\(\|.*[^a-zA-Z0-9_]\)word\([^a-zA-Z0-9_].*\|\)$'

This is not a BRE. BRE does not have a | operator. :) You'd need to
use multiple expressions.

> I guess nearly every implementation now supports extended RE. With 
> uClibc, you can't even select to omit ERE support.
> 
> BRE really suck!

BTW according to POSIX bracket expressions are identical in BRE and
ERE, i.e. you can still use the character classes. The expression
above is correct only in ASCII-only locale; otherwise it will consider
any non-ascii letter to be a word break.

Rich




More information about the busybox mailing list