tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: TRE regex



In article <20160606213525.46a4365b2c8cef82072664cf%schemamania.org@localhost>,
James K. Lowden <tech-userlevel%netbsd.org@localhost> wrote:
>Back in 2009, Matthias-Christian Ott ported Ville Laurikari's regex
>library, apparently with the intention of replacing the one in base,
>originally from Henry Spencer.  
>
>	http://mail-index.netbsd.org/tech-userlevel/2009/08/03/msg002477.html
>
>What happened?  Other than the announcement, I find no discussion about
>it.  I see it's in pkgsrc, all well and good, but why was  the project
>was undertaken and the work not brought into base?  

It is in /usr/lib/libtre* and there are unit-tests that check both it
and the spenser regex.

>In case you are feeling complacent about NetBSD's regex, the awk
>documentation relies on it, and falls short.  Awk claims to implement
>regex per egrep(1) -- providing no further description -- but that's
>just docurot: 
>
>	$ echo aaa | egrep 'a{3}' | wc -l
>	       1
>	$ echo aaa | awk '/a{3}/' | wc -l
>	       0
>

Awk implements its own (see b.c) (but that does not implement the API).

>As far as I know, we have 3 regex definitions in base: GNU grep, NetBSD
>sed (with regex(3), defined by re_format(7)), and NetBSD awk.  It would
>be an improvement IMO to use one implementation for all utilities in
>base, to make them internally consistent and dependable (and
>reproducible), even at the expense of compatibilitly with GNU's
>implementations.  

14 (libc, TRE, grep, nvi, cvs, libiberty x 6, gettext, diffutils, less)
15 if you count awk.

christos



Home | Main Index | Thread Index | Old Index