[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Fun with regular expressions

  • To: "'xml-dev@l...'" <xml-dev@l...>
  • Subject: Fun with regular expressions
  • From: Max Chappell <max@m...>
  • Date: Wed, 04 Feb 2004 15:12:38 +0000
  • Organization: Maxxml Limited
  • Reply-to: max@m...
  • User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)

regular expression fun
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





PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.