On Mon, 20 Jul 2009, Mahendra Ladhe wrote:

>      as seen in the screen output below, PCRE does not reject regular 
> expressions
> which are anchored as well as quantified.
> e.g. (^a){2}
> 
> mla...@linux45:~] pcretest
> PCRE version 7.6 2008-01-28
> 
>   re> /(^a){2}/
> data> aa
> No match
> data> a
> No match
> data> a\na
> No match
> data>
> 
> The given regular expression is not matching with anything. So why to accept 
> it ?
> It should be rejected by PCRE.

There are plenty of patterns that can never match with anything. It is
very easy to invent others, for example /(?=a)b/. PCRE cannot detect
them all, and it does not try. Perl does not reject this pattern either, 
and I suspect that few regex engines would.

Philip

-- 
Philip Hazel
-- 
## List details at http://lists.exim.org/mailman/listinfo/pcre-dev 

Reply via email to