Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jan 2014 22:32:55 +0100
From:      rank1seeker@gmail.com
To:        "Tim Kientzle" <tim@kientzle.com>
Cc:        hackers@freebsd.org, Mark Blackman <mark@exonetric.com>
Subject:   Re: Is this a regex bug?
Message-ID:  <20140126.213255.017.3@DOMY-PC>
In-Reply-To: <88CC5471-AD3A-4841-89BB-23D585F77079@kientzle.com>
References:  <20140126.210430.622.1@DOMY-PC> <88CC5471-AD3A-4841-89BB-23D585F77079@kientzle.com>

next in thread | previous in thread | raw e-mail | index | archive | help

> -n is being interpreted as an option to ‘echo’ and being swallowed before it gets to egrep.

> 

> - Mark





I've tried without echo



printf "\-n\n" | egrep '^\-[[:alnum:]]+$'



This works!

Thanks for pointing out.







> Try without the grep:

> 

> $ echo '-m'

> -m

> $ echo '-n'

> $ echo '-o'

> -o

> $ man echo

> 

> 

> 

> 

> On Jan 26, 2014, at 1:04 PM, rank1seeker@gmail.com wrote:

> 

> > Or am I crazy?

> > 

> > echo '-m' | egrep '^\-[[:alnum:]]+$'

> > echo '-n' | egrep '^\-[[:alnum:]]+$'

> > echo '-o' | egrep '^\-[[:alnum:]]+$'

> > 

> > Guess what?

> > Only middle one, '-n' doesn't match it.

> > Is this an RE bug or I clearly ain't seeing obvious?!

> > 

> > echo '-n' | egrep '^\-[0-9A-Za-z]+$'

> >    Doesn't work either

> > 

> > 9.2-RELEASE-p3  i386



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140126.213255.017.3>