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 6157487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:47:38+00:00 2026-05-23T20:47:38+00:00

Consider the following regular expression pattern = (0[1-9]|1[012])/(0[1-9]|[12][0-9]|3[01])/(19|20)\d\d This pattertn represents date strings in

  • 0

Consider the following regular expression

pattern = "(0[1-9]|1[012])/(0[1-9]|[12][0-9]|3[01])/(19|20)\d\d"

This pattertn represents date strings in MM/DD/YYYY format. Now, if I want to create several attribues of this type, I can apparently write them like:

element holiday 
{
 attribute beginDate
 {
  xs:string { pattern = "(0[1-9]|1[012])/(0[1-9]|[12][0-9]|3[01])/(19|20)\d\d" }
 }
 attribute endDate
 {
  xs:string { pattern = "(0[1-9]|1[012])/(0[1-9]|[12][0-9]|3[01])/(19|20)\d\d" }
 }
}

But this is very inconvenient to write the pattern line every time when I want to define a date in such format. I would like to define my own type, e.g. MyDateFormat, and use it where necessary as attribute someDate { MyDateFormat } instead of rewriting the same code multiple times, but I couldn’t find a way to define own types using Relax NG compact syntax. My question is how is it possible to implement such behaviour and avoid code twice rewriting.

Any help will be appreciated. Thanks in advance.

  • 1 1 Answer
  • 2 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-23T20:47:39+00:00Added an answer on May 23, 2026 at 8:47 pm

    Found out one solution: new type can be defined as

    MMDDYYYY = xs:string { pattern = "(0[1-9]|1[012])/(0[1-9]|[12][0-9]|3[01])/(19|20)\d\d" }
    

    and then use it where necessary:

    element holiday 
    {
     attribute beginDate { MMDDYYYY }
     attribute endDate   { MMDDYYYY }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the two following regular expression snippets and dummy HTML that it should be
Consider the following Javascript regular expression matching operation: class1 MsoClass2\tmsoclass3\t MSOclass4 msoc5.match(/(^|\s)mso.*?(\s|$)/ig); I would
Consider following string Some string with quotes and \pre-slashed\ quotes Using regex, I want
consider following: 1st APPROACH: public void f3() { f2(); f1(); } and this ...
Consider the following regular expressions: 7+ (7)+ Does anyone that is very familiar with
Consider the following situation: I want to replace links in a string, specifically I
This question relates to character class subtraction in regular expression (regex). I refer to
Consider: <div><a href=http://anirudhagupta.blogspot.com/>Anirudha Web blog</a></div> What is the regular expression to get http://anirudhagupta.blogspot.com/ from
Consider the following strings: 1) Scheme ID: abc-456-hu5t10 ( High priority ) ***** 2)
Consider the following string: ab(cd.xz) e(ab(fg).xz)) ab(hi.xz) I want to match every substring that

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.