xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bil Mason <Bil.Ma...@healthcare.com>
Subject RE: regexp validation with XercesJ
Date Fri, 27 Apr 2001 14:50:15 GMT
In your second example the "[0-9]+" part will match one-or-more digits.
Both "1" and "1.23" start with one-or-more digits so that expression
matches.  That's it.  The fact that there are more characters after the "1"
part of "1.23" means the pattern failed to match ALL of the data.

Here is another (simpler?) version of your first pattern:

([0-9]*\.)?[0-9]+


-----Original Message-----
From: Etienne Roy [mailto:eroy@us.ibm.com]
Sent: Thursday, April 26, 2001 5:41 PM
To: general@xml.apache.org
Subject: regexp validation with XercesJ


Hi all,

I've got a problem validating against a regexp pattern for an attribute.
Simplifying my regexp I found a weird behaviour of the validator:

(([0-9]*[.][0-9]+)|([0-9]+))    matches  '1' and '1.23' but
(([0-9]+)|([0-9]*[.][0-9]+))    matches '1' but NOT '1.23'

Is there a problem with my regexp ? Or did anyone encountered something
similar ??
Thanks for any help

Etienne

--
More details:

I use xerces-J 1.3.1
java version "1.3.0"
I validate with sax.SAXCount -v (and I tried dom.DOMCount -v)

snippet of my schema:
   <simpleType name="TestRegExp">
     <restriction base="string">
               <pattern  value='(([0-9]+)|([0-9]*[.][0-9]+))'/>
     </restriction>
   </simpleType>

I had the same behaviour with '*' instead of '+', with or without
parenthesis, with [.] or \.


---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org





======================= Confidentiality Statement ======================= 
The information contained in this message and any attachments is 
intended only for the use of the individual or entity to which it is 
addressed, and may contain information that is PRIVILEGED, CONFIDENTIAL 
and exempt from disclosure under applicable law.  If you have received 
this message in error, you are prohibited from copying, distributing, or 
using the information.  Please contact the sender immediately by return 
e-mail and delete the original message from your system. 
===================== End Confidentiality Statement =====================  



---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message