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

  • Home
  • SEARCH
  • 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 4121814
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:24:02+00:00 2026-05-20T23:24:02+00:00

Essentially I want to know if a specific XSD schema can be replaced by

  • 0

Essentially I want to know if a specific XSD schema can be replaced by a regular expression or not. I know that XML Schema language can produce XSDs whose set of valid XML instances can be of any type of language (even context-sensitive). I want to identify those schemas that are "regex-equivalent". I came up with this question after tackling the following problem:

I needed to parse a specific text format and I first tried regular expressions and I saw that regexp is sufficient to parse it. I then wanted to make an XML representation for the messages that I received in this format so I mapped regex groups with XML elements. I then created manually an XSD schema based on the structure of the regex. In the end , I had a schema that could replace my regex, in the sense that the original regex was possible to be constructed from the schema. I also managed to do the opposite: Create the schema automatically from the regex. So I could transform the message into XML and validate it on the same time. My questions are:

  1. Can every regex be represented by an XSD schema? (I mean, given a regex to be able to produce an XSD schema)

  2. Given an arbitrary XSD schema is there a way to determine if there is a regex whose representation is the given schema?

    EDIT: Probably the answer to 1st question is yes since i did it with my regex in a way that did not depend on the specific regex (This isn’t a proof for every regex).

  • 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-05-20T23:24:03+00:00Added an answer on May 20, 2026 at 11:24 pm

    XML Schema language is a super-set of regular languages, but only within the domain of XML documents, obviously.

    For #1: with the added condition that the regex matches a well-formed XML document and nothing else, yes.

    For #2: yes, it’s a matter of checking for any features of XSD which are allowed in a regular language. Finding the regular expression would be much more work.

    A regular language has a fairly simple definition, informally:

    • The empty set/string
    • Literals (a “singleton language”), e.g., “x”
    • For a regular language A, A* is also a regular language
    • For regular languages A and B, A|B (union) and AB (concatenated) are regular.

    Basically, all concatenations and alternations are fine but recursion is impossible and there’s no back-references or “memory”. No element type can contain choice/all/element elements referencing itself or parent types, and you can’t make use of any information you found earlier in the parsing process.

    The restriction on recursion extends to the any element, which would be forbidden. By definition it accepts any element, including elements with sub-elements. Since you don’t know the nesting depth of this unknown element you need a recursive pattern to match it, and you can’t do that in a regular language.

    The restriction on back-references means you can’t do things like “some number of ‘A’ followed by the same number of ‘B'” (A{n}B{n}). I don’t think this is even possible in XSD, however, at least I can’t think how you would do it.

    Restricting numeric values (e.g., minInclusive) would not be possible in a regex.

    The all element would be problematic in that it would have to accept all the possible orderings of child elements, which would make the regex expand exponentially (binomial coefficient, (n/k)^k <= n!/k!(n-k)! <= (ne/k)^k) with the number of child elements, and matching the regex is super-linear on that length. Recognizing attributes suffers from the same issue, since the ordering of attributes within an element is not constrained by the schema. Of course, if you only care about whether a regex exists and not about finding it, then it doesn’t matter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Essentially I want to know if in VB.NET 2005 if using a sqlcommand and
I know that when declaring a page method in ASP.NET, I can specify a
I essentially want to spider my local site and create a list of all
We have a reverse proxy here, running Apache in version 2.2.x Essentially I want
I want to write a piece of software which is essentially a regex data
Essentially the only thing I can deploy to my deployment machine is a JAR
I have essentially a survey that is shown, and people answer questions a lot
I have a rather specific question perhaps.. I have a user that will enter
I have written a windows service in C# that essentially listens for commands on
Here is what I would like to do, and I want to know how

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.