Re: xsd regular expression query
- From: usenet@xxxxxxxxxxxxxxxxxx
- Date: 3 Apr 2007 04:46:45 -0700
On 30 Mar, 14:30, ror...@xxxxxxxxx wrote:
On Mar 30, 2:02 pm, Bjoern Hoehrmann <bjo...@xxxxxxxxxxxx> wrote:
* ror...@xxxxxxxxx wrote in comp.text.xml:
I have a regular expression that allows only certain characters to be
valid in an xml doc as follows:
<xs:pattern value="^[ dgHhMmstyf,\-\./:;\\]*" />
What I want to do is also allow any unicode character that is enclosed
in single quotes to also be valid, no matter where they appear. I
tried the following:
<xs:pattern value="^[ dgHhMmstyf,\-\./:;\\]*('*)*" />
But this only works if the characters in quotes appear after the other
text.
You are looking for "(a character from a certain set, or the character '
followed by zero or more characters except the character ' followed by
the character ') zero or more times", i.e. something like
([a-z]|'[^']*')*
if the first set of characters was a-z.
--
Björn Höhrmann · mailto:bjo...@xxxxxxxxxxxx ·http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 ·http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 ·http://www.websitedev.de/
Not quite - I want to allow the character(s) in quotes to be able to
appear with the character(s) from the specified set but not in any
particular place i.e. not necessarily at the beginning or end. For
example, I want the following to be valid:
dddd, d. MMMM yyyy
dddd, d. MMMM MyYear
MyDay, d. MMMM yyyy
dddd, d. MyMonth yyyy
so MyDay, MyYear and MyMonth appear in single quotes in the xml file
and are valid.- Hide quoted text -
- Show quoted text -
It looks to me that Björn's pattern achieves this. (Which filling in
the dots would be:
(^[ dgHhMmstyf,\-\./:;\\]|'[^']*')*
Can you do a test program and show some examples where it does not
work?
Cheers,
Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================
.
- Follow-Ups:
- Re: xsd regular expression query
- From: rorymo
- Re: xsd regular expression query
- Prev by Date: Validation of xml file against DTD
- Next by Date: Re: Difference between server-side and client-side XSL processing
- Previous by thread: Validation of xml file against DTD
- Next by thread: Re: xsd regular expression query
- Index(es):
Relevant Pages
|