restrict simpleType to word characters and spaces except digits

Discussion in 'XML' started by Anil Mamede, Apr 4, 2008.

  1. Anil Mamede

    Anil Mamede Guest

    Hi,

    I'm having an hard time to build a regular expression that:
    - Will accept words;
    - Will accept spaces;
    - But cannot accept digits;

    Examples:

    This is a game
    Olá Mundo
    Módulo A

    An initial approach was:

    <xs:simpleType name="nomeType">
    <xs:restriction base="xs:string">
    <xs:maxLength value="255" />
    <xs:pattern value="[\w\s]+" />
    </xs:restriction>
    </xs:simpleType>

    But this will accept values like this:

    Módulo 1234

    I could use "[\w\s]+" [a-zA-Z\s] but i've to accept other letters from
    ISO-8859-15 like á or Í.

    The attempt:


    <xs:simpleType name="nomeType">
    <xs:restriction base="xs:string">
    <xs:maxLength value="255" />
    <xs:pattern value="[\w\s]+" />
    <xs:pattern value="\D+" />
    </xs:restriction>
    </xs:simpleType>

    does not work either.

    Thanks in advance,

    Anil Mamede
     
    Anil Mamede, Apr 4, 2008
    #1
    1. Advertisements

  2. Anil Mamede wrote:

    > <xs:simpleType name="nomeType">
    > <xs:restriction base="xs:string">
    > <xs:maxLength value="255" />
    > <xs:pattern value="[\w\s]+" />
    > </xs:restriction>
    > </xs:simpleType>


    The specification <URL:> defines
    \w
    as
    "[#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}] (all characters except the set
    of "punctuation", "separator" and "other" characters)"
    so that includes digits.

    If you use
    <xs:pattern value="\P{N}+"/>
    then you allow anything that is not a "Number" character.

    Or you need to list the characters you want to allow.



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Apr 4, 2008
    #2
    1. Advertisements

  3. Anil Mamede

    Anil Mamede Guest

    On 4 Abr, 18:35, Martin Honnen <> wrote:
    > Anil Mamede wrote:
    > > <xs:simpleType name="nomeType">
    > > <xs:restriction base="xs:string">
    > > <xs:maxLength value="255" />
    > > <xs:pattern value="[\w\s]+" />
    > > </xs:restriction>
    > > </xs:simpleType>

    >
    > The specification <URL:> defines
    > \w
    > as
    > "[#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}] (all characters except the set
    > of "punctuation", "separator" and "other" characters)"
    > so that includes digits.
    >
    > If you use
    > <xs:pattern value="\P{N}+"/>
    > then you allow anything that is not a "Number" character.
    >
    > Or you need to list the characters you want to allow.
    >
    > --
    >
    > Martin Honnen
    > http://JavaScript.FAQTs.com/


    Martin Honnen thanks a lot. I'll try that.
     
    Anil Mamede, Apr 6, 2008
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Salerno
    Replies:
    20
    Views:
    1,205
    John Salerno
    Aug 11, 2006
  2. Fabio Z Tessitore

    who is simpler? try/except/else or try/except

    Fabio Z Tessitore, Aug 12, 2007, in forum: Python
    Replies:
    5
    Views:
    663
  3. David House

    try -> except -> else -> except?

    David House, Jul 6, 2009, in forum: Python
    Replies:
    2
    Views:
    556
    Bruno Desthuilliers
    Jul 6, 2009
  4. Peng Yu
    Replies:
    1
    Views:
    741
    Steven D'Aprano
    Nov 18, 2009
  5. johkar
    Replies:
    2
    Views:
    3,882
    Mayeul
    Dec 10, 2009
  6. kanpeter
    Replies:
    0
    Views:
    1,410
    kanpeter
    Oct 26, 2010
  7. Karen
    Replies:
    5
    Views:
    154
    HolaGoogle
    Sep 26, 2003
  8. Peng Yu
    Replies:
    2
    Views:
    431
    Peter Makholm
    Dec 4, 2012
Loading...