W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2003

RE: Patterns and Decimal

From: daniella d <daneladg@yahoo.co.uk>
Date: Fri, 28 Feb 2003 08:46:22 +0000 (GMT)
Message-ID: <20030228084622.36924.qmail@web20711.mail.yahoo.com>
To: Paul Warren <pdw@decisionsoft.com>
Cc: xmlschema-dev@w3.org

Thanks. I rewrote the expessions as you suggested and it now works fine. The regular expession  (0(\.[0-9]{0,3})|[1-9][0-9]*(\.[0-9]+)?) checks all the cases.
daniella
 Paul Warren <pdw@decisionsoft.com> wrote:On Thu, 2003-02-27 at 15:42, Anli Shundi wrote:
> I think the regular expressions should be rewritten
> to escape the dot, i.e.
> 
> 
> 
> 
> 
> If the dot is unescaped it matches any character,
> thus "[0-9][.][0-9]*" matches 0123.

No. "[.]" is a perfectly valid way to match a literal ".". See:

http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#nt-charRange

It is equivalent to "[\.]" and to "\.".

Personally, I'd write it as (0\.[0-9]*|[1-9][0-9]*(\.[0-9]*)?)

but in fact, I'd probably want: (0(\.[0-9]+)?|[1-9][0-9]*(\.[0-9]+)?)

as this allows "0", but forbids "0." and "123." etc.

Paul





---------------------------------
With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your needs
Received on Friday, 28 February 2003 03:46:25 GMT

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