Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8325211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:21:20+00:00 2026-06-09T00:21:20+00:00

I am working on creating an XSD for a web service that will take

  • 0

I am working on creating an XSD for a web service that will take in an ID number as an element in the XML. These ID numbers consist of 10 consecutive digits ([0-9]{10}), but I was trying to create a regular expression that could exclude certain elements from this range.

For example, here is the restriction I have currently in my XSD:

    <xsd:restriction base="xsd:string">
        <xsd:pattern value="[0-9]{10}" />
    </xsd:restriction>  

I need the restriction to allow a string of [0-9]{10} that doesn’t fit the following IDs:

    All 0's:         [0]{10}
    Starting with 6: [6][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
    Starting with 000: [0][0][0][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
    Starting with 999: [9][9][9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
    Ends with 2 0's: [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0][0]
    4 0's in Middle: [0-9][0-9][0-9][0][0][0][0][0-9][0-9][0-9]

Is this possible to do from within the XSD or regular expression?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:21:23+00:00Added an answer on June 9, 2026 at 12:21 am

    I’d rephrase your restrictions a bit:

    • The first digit must not be a 6.
    • At least one of the last two digits must not be a zero.
    • At least one of the middle four digits must not be a zero.

    The first restriction, an ID only consisting of zeroes, is actually included in the two last restrictions.

    The first restriction can be expressed by a set of allowed characters that does not include 6, i.e. [0-57-9].

    For the other restrictions, a straightforward solution is to start at the beginning of a section that must not consist only of zeroes and assume a non-zero digit; if that assumption is true, the remaining digits may include zeroes; otherwise the first digit in that section must be a zero and for the remaining characters, this rule can be repeated recursively until only one character is left: ([1-9][0-9]{3}|0(... repeat for three digits, then two digits, ...))

    Therefore, a suitable RegEx would be:

    [0-57-9][0-9]{2}([1-9][0-9]{3}|0([1-9][0-9]{2}|0([1-9][0-9]|0[1-9])))[0-9]([1-9][0-9]|0[1-9])
    

    Update: The additional restrictions require the following:

    • At least one of the first three digits must not be a 0.
    • At least one of the first three digits must not be a 9.

    This can be included the same way as above, accepting either anything except 0 and 9, or either of these two numbers:

    ([1-57-8][0-9]{2}|0([1-9][0-9]|[0-9][1-9])|9([0-8][0-9]|[0-9][0-8]))([1-9][0-9]{3}|0([1-9][0-9]{2}|0([1-9][0-9]|0[1-9])))[0-9]([1-9][0-9]|0[1-9])
    

    The new part is in the front of the expression:

    ([1-57-8][0-9]{2}|0([1-9][0-9]|[0-9][1-9])|9([0-8][0-9]|[0-9][0-8]))
    

    So,

    • either the ID starts with neither a 0 nor with a 9. In that case, there are no restrictions for the next two digits.
    • or the ID starts with a 0. In that case, one of the next two digits must not be a zero, either the first one or the second one.
    • or the ID starts with a 9. In that case, one of the next two digits must not be a nine, either the first one or the second one.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on creating a windows service that will send emails to a customer
I am working on creating a web app that will query event logs on
I'm working on creating a WCF web service that communicates via JSON. I got
I'm working on creating a single command that will run mulitple things on the
I am working on creating a Windows Phone app that will play a series
We are working on creating an installation package for a WCF-based web service. The
I'm working on creating a web shop for a friend and I'm using the
I am working on creating what I hope one day will be a publicly
i'm working on creating an app that streams mp3s from a server. i'm using
I am currently working on creating a header file that acts like the standard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.