Accept empty phone numbers

Discussion in 'XML' started by Yo, Nov 8, 2010.

  1. Yo

    Yo Guest

    Hello,

    I am new at XSD schema.
    In a schema, I have a regular expression used to check a phone number.
    This expression works, but I'd like to allow also an empty string for
    phone numbers.

    Is there a simple way for me to modify my regular expression for that
    in my XSD schema ? And if not, how can I achieve it ?

    Thank you for your help.
    Yo, Nov 8, 2010
    #1
    1. Advertising

  2. Yo wrote:

    > I am new at XSD schema.
    > In a schema, I have a regular expression used to check a phone number.
    > This expression works, but I'd like to allow also an empty string for
    > phone numbers.
    >
    > Is there a simple way for me to modify my regular expression for that in
    > my XSD schema ? And if not, how can I achieve it ?


    If you wrap your expression in
    ()?
    e.g.
    (\d{5} \d{4,10)})?
    it should work I think.




    --

    Martin Honnen
    http://msmvps.com/blogs/martin_honnen/
    Martin Honnen, Nov 8, 2010
    #2
    1. Advertising

  3. Yo

    Yo Guest

    Après mûre réflexion, Martin Honnen a écrit :
    > Yo wrote:
    >
    >> I am new at XSD schema.
    >> In a schema, I have a regular expression used to check a phone number. This
    >> expression works, but I'd like to allow also an empty string for phone
    >> numbers.
    >>
    >> Is there a simple way for me to modify my regular expression for that in my
    >> XSD schema ? And if not, how can I achieve it ?

    >
    > If you wrap your expression in
    > ()?
    > e.g.
    > (\d{5} \d{4,10)})?
    > it should work I think.


    That's exactly what I did while thinking by myself, and it works
    perfectly. Thank you anyway for your idea ! ^^
    Yo, Nov 8, 2010
    #3
    1. Advertising

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. Andrew Banks
    Replies:
    2
    Views:
    20,884
    Andrew Banks
    Jan 5, 2004
  2. Zahoor
    Replies:
    1
    Views:
    804
    Darryl L. Pierce
    Nov 15, 2003
  3. Blasting Cap

    Formatting phone numbers in gridview

    Blasting Cap, Jan 14, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    344
    Blasting Cap
    Jan 14, 2007
  4. chen selina
    Replies:
    0
    Views:
    879
    chen selina
    Jul 7, 2010
  5. Rene Ivon Shamberger

    convert Phone Letters to Phone numbers

    Rene Ivon Shamberger, Dec 4, 2012, in forum: C++
    Replies:
    5
    Views:
    381
Loading...

Share This Page