W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2001

Is <pattern value="(.)+\.(gif|jpg|jpeg|bmp)"/> allowed?

From: Stanley Guan <Stanley.Guan@oracle.com>
Date: Tue, 16 Oct 2001 17:19:46 -0700
Message-ID: <3BCCCEA2.27A505A@oracle.com>
To: xmlschema-dev@w3.org
Hi,

Please see the following discussions for details.  But, is the
following regular expression allowed?
    <pattern value="(.)+\.(gif|jpg|jpeg|bmp)"/>

Thx,

-Stanley


Stanley Guan wrote:

> Kongyi,
>
> I remember you said that at the end of matching if there are
> some pattern string not consumed, it's also an error!
>
> In this case, I think the better regular expression is
>   <pattern value="[\.]+\.(gif|jpg|jpeg|bmp)"/>
>
> In the original patten, everything in the following string:
>    /images/oj_image.bmp
> will be matched by (.)+ and leaving \.(gif|jpg|jpeg|bmp)
> not used.

This means match the whole string with (.)+ is wrong, the processor
should be able to roll back and try other possibilities.
It is an error only when there is no better way to match!

Kongyi

>
> Thx,
>
> -Stanley
>
> Kongyi Zhou wrote:
>
> > My understanding is a regrex does not need to be deterministic.
> >
> > Thanks,
> >
> > Kongyi
> >
> > Stanley Guan wrote:
> >
> > >  Kongyi,
> > >
> > > Isn't the following pattern
> > >           <pattern value="(.)+\.(gif|jpg|jpeg|bmp)"/>
> > > invalid because (.) will match anything except \n and \r
> > > and it matches \. or any of 'gif', 'jpg', 'jpeg', or 'bmp'?
> > >
> > > Thx,
> > >
> > > -Stanley
Received on Tuesday, 16 October 2001 20:20:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:24 GMT