OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Fun with regular expressions

[ Lists Home | Date Index | Thread Index ]

Hi,

[^N].* should work.  It works for me with Xerces-J (2.4.0 and 2.2.1).

[.-[NaN]]* doesn't work because "." is just a normal character inside square
brackets.

Hope that helps,
Priscilla

> -----Original Message-----
> From: Max Chappell [mailto:max@maxxml.co.uk] 
> Sent: Wednesday, February 04, 2004 10:13 AM
> To: 'xml-dev@lists.xml.org'
> Subject: [xml-dev] Fun with regular expressions
> 
> Hi,
> 
> I need to restrict xs:double to any allowable double value - with the 
> exception of NaN.
> 
> Having looked further into regular expressions for XML Schema - there 
> seems to be contradictory advice around.
> 
> Following one set of advice would allow us to use ^ at the 
> start of the 
> reg exp to exclude NaN:
> "[^N].*"  - this doesn't work with either Xerces or XML Spy.
> I find the relevant section of the W3C spec somewhat difficult to 
> decipher. However, I get the impression that ^ is simply a normal 
> character in xsd land..
> 
> Another piece of advice is to use nested brackets such as: 
> "[a-zA-Z-[ABC]]" (Use any letters except AB or C).
> Along these lines I've tried:
> "[.-[NaN]]*" - far from working...
> and "[.*-[NaN]]*" - ditto... 
> 
> So then, the next option is to define a larger regular 
> expression such as:
> "[+\-]?(\d+(\.\d*)?([eE][+\-]?\d+)?)|([+\-]?INF)"
> 
> This does not allow .00009 for example, so we'll have to make the reg 
> exp even more complicated.
> 
> 
> My question is:
> Does anyone know of a simpler way of doing this?
> 
> Thanks
> 
> Max
> 
> 
> 
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
> 
> 





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS