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

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