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

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 UTC