Subject: Re: Quick RegExp question
To: None <paul@whooppee.com>
From: Ben Harris <bjh21@netbsd.org>
List: current-users
Date: 04/22/2003 11:37:00
In article <Pine.NEB.4.43.0304211327500.26343-100000@pc1.whooppee.com> you write:
>It the following correct:
>
> pc1:paul {201} cat xxx
> 704:1
> 704:2
> 704:3
> pc1:paul {202} grep '^704:\(2\)\{0,0\}$' xxx
> 704:2
> pc1:paul {203}
>
>I would expect the regular expression to say "match anything that
>starts with '704:' followed by exactly zero occurrences of '2',
>followed by end-of-line. Instead, it seems to be treating the {0,0}
>as though it were {1,1}.
>
>There's no restriction in the re_format(7) man page that says the
>bounds cannot be {0,0}.
A quick check of POSIX indicates that \{m,n\} is meant to work for all
0 <= m <= n <= {RE_DUP_MAX}, so \{0,0\} is perfectly valid.
I haven't yet found a version of grep that agrees with me, though, so I may
be misreading something.
--
Ben Harris <bjh21@netbsd.org>
Portmaster, NetBSD/acorn26 <URL:http://www.netbsd.org/Ports/acorn26/>