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

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

From: Ross Thompson <rthompson@contivo.com>
Date: Wed, 17 Oct 2001 11:43:19 -0700
Message-ID: <15309.53575.731890.541142@localhost.localdomain>
To: Stanley Guan <Stanley.Guan@oracle.com>
Cc: xmlschema-dev@w3.org
Stanley Guan writes:
 > Ross,
 > Actually, it can be more succinctly represented as:
 >   ".+"
 > because "." will match the rest of the pattern string.

Sorry, no.  ".+" does not match the same set of
strings as the original expression.  It matches "foo.txt", for
example, which ".+\.(gif|jpg|jpeg|bmp)" does not.

 > My point is:
 >   For the particles, they are subject to ambiguity constraints (
 >   Unique Attribution ($3.8.6)).  For example, if an instance
 >    element could match either an explicit particle and a wildcard
 >    that model is in error.
 > Do we have something similar to Unique Attribution for patterns?
 > In my original posting, there was a typo.  The better specification
 > is
 >    <pattern value="[^\.]+\.(gif|jpg|jpeg|bmp)"/>
 > which is not ambiguous.  And I don't think most of the schema
 > processor will try to roll back and find a better matching as described
 > in Kongyi's response!

I missed the early part of this discussion, so I'm not sure what
you're talking about.  However, you can't write a regular expression
matcher that behaves correctly without considering the case where the
first two characters in ".+\.gif" match less than the entire string.

- Ross

I have the heart of a little child.  I keep it in a jar on my desk.
					-- unknown
Received on Wednesday, 17 October 2001 14:43:30 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:54 UTC