Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: xsd regular expression query >Thread Next - Re: xsd regular expression query Re: xsd regular expression queryTo: NULL Date: 4/4/2007 9:08:00 AM
On Apr 3, 12:46 pm, use...@tech-know-ware.com wrote:
> On 30 Mar, 14:30, ror...@gmail.com wrote:
>
>
>
>
>
> > On Mar 30, 2:02 pm, Bjoern Hoehrmann <bjo...@hoehrmann.de> wrote:
>
> > > * ror...@gmail.com 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=3D"^[ dgHhMmstyf,\-\./:;\\]*" />
>
> > > >What I want to do is also allow any unicode character that is enclos=
ed
> > > >in single quotes to also be valid, no matter where they appear. I
> > > >tried the following:
>
> > > ><xs:pattern value=3D"^[ dgHhMmstyf,\-\./:;\\]*('*)*" />
>
> > > >But this only works if the characters in quotes appear after the oth=
er
> > > >text.
>
> > > You are looking for "(a character from a certain set, or the characte=
r '
> > > 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=F6rn H=F6hrmann =B7 mailto:bjo...@hoehrmann.de =B7http://bjoern.ho=
ehrmann.de
> > > Weinh. Str. 22 =B7 Telefon: +49(0)621/4309674 =B7http://www.bjoernswo=
rld.de
> > > 68309 Mannheim =B7 PGP Pub. KeyID: 0xA4357E78 =B7http://www.websitede=
v=2Ede/
>
> > 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=F6rn'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.
> --
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> 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/
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D- Hide quote=
d text -
>
> - Show quoted text -
The pipe(|) in you regular expression means 'or' right? If so then you
can only have the characters dgHhMmstyf,\-\./:;\\ OR characters in
quotes but not both in the same string so you can have:
dddd, d. MMMM yyyy
OR
'ab$olutN0n$en$e'
But not
dddd, d. MMMM yyyy 'ab$olutN0n$en$e'
Does this make sense?
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
