How to check EMBG (Unique Master Citizen Number) using regex

In this post, I will share my implementation of how to check if some number looks like EMBG or Unique Master Citizen Number. For those of you who are not aware what is EMBG (Unique Master Citizen Number), please check Unique Master Citizen Number . Long story short, it's a composition of 13 digits, where first 7 digits are representing date in format ddMMyyy, and for the rest of the digits please check the wiki link. The yyy are the last 3 digits of year. The last digit from the 13-digit composition is checksum number, and should be checked outside of regex checking. The following regex should be validating EMBG (Unique Master Citizen Number) for Macedonia, but can be modified to check Unique Master Citizen Number for the rest of exYu countries (except Croatia, which seems that has changed the format according to the wiki article). The regex is validating 20th and 21th century year. Also, it's aware of leap year, and validating 2902 in ddMM input, if applicable.
Here is the regex :

^(?:(?:(?:0[1-9]|1\d|2[0-8])(?:0[1-9]|1[0-2])|(?:29|30)(?:0[13-9]|1[0-2])|31(?:0[13578]|1[02]))[09]\d{2}|2902[09](?:[02468][048]|[13579][26]))4[1-9]\d{4}$

 

And the diagram for the syntax is following:


Here are some tests using powershell:


The usage of this regex can be various, starting from beginner code input testing, to some exchange transport rule or data loss prevention rules. 

Feel free to test, and have some fun.



15 comments:

  1. I love your content and the lessons you share with your readers. Every time I read a post how to write a dissertation methodology I feel like I am able to take advantage of this post.

    ReplyDelete
  2. Superslot or Thai home language is called super slot. We are an online slots provider, there are many slots games to choose from, play a lot on mobile phones, number 1, both free credit 50, 100, 150, 200 that can support both IOS and Android systems, easy to apply, have easy access to log. -in has a system to make a top-up transaction Withdraw money via automatic system 24 hours a day,

    ReplyDelete
  3. You've made some good points there. I looked on the internet for additional information about the issue and found most people will go along with your views on this website. สล็อต ฟรีเครดิต

    ReplyDelete
  4. for more info visit this link https://www.stelladatarecovery.com/email-migration/ost-to-office-365.php

    ReplyDelete
  5. Thank you again for all the knowledge you distribute,Good post. I was very interested in the article, it's quite inspiring I should admit. I like visiting you site since I always come across interesting articles like this one.Great Job, I greatly appreciate that.Do Keep sharing! Regards, weed for sale

    ReplyDelete
  6. You have outdone yourself this time. It is probably the best, most short step by step guide that I have ever seen. microaire cannulas

    ReplyDelete
  7. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work xprinter label printer

    ReplyDelete
  8. Now that’s an amazing post on the modern struggles faced by students while preparing the scholarly assignments. I definitely agree with you on the restraints you have mentioned. I think the best way to get rid of these obstacles is by hiring a reliable online Dissertation Writing Service with the portal such as that of the MyAssignmentHelpAU platform. The expert researchers, editors, proofreaders, and writers associated with our writing portal carry years of experience working in the writing sector and thus can easily develop any type of assignment for you within the shortest possible turnaround.

    ReplyDelete
  9. I really like your blog. It helped me a lot. Entire details were given with easy to understand words. I wish you the best of luck for your future endeavors
    hbo go activate
    Hbogo.com/activate

    ReplyDelete
  10. Use Assignment Help services to finish your work effectively. If you are facing issues in writing your academic papers, you must use an online source of expert help. It is quite obvious to pay someone to do my assignment seem difficult to you when you don’t have complete information about the service provider. So, it is good to dig out the full details of your selected service provider and pay the price as soon as possible.

    ReplyDelete
  11. We are providing essay help . You can reach out us now! we are providing this help since the past 10 years.

    ReplyDelete
  12. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work ultrasound skin scrubber

    ReplyDelete
  13. Nice blog, thanks for sharing with us this valuable information. I’m always read your blog for and I have got a lot of informative blog for this. by
    digitizing for embroidery machines

    ReplyDelete
  14. I am so grateful for your blog. That is a very valuable article for me. "How to check EMBG (Unique Master Citizen Number) using regex" this blog includes full detail. The usage of this regex can be various, starting from beginner code input testing, to some exchange transport rules or data loss prevention rules. If you have interested in the best USA VPS Hosting you can ask us for more features and services.
    Thanks for sharing...!!!

    ReplyDelete
  15. Global lactose market is highly fragmented and the major key players have used various strategies such as new product launches, expansions, agreements, joint ventures, partnerships, acquisitions, and others to increase their footprints in the market worldwide.

    Also read: acetic anhydride market | Tobacco Market


    ReplyDelete

How to check EMBG (Unique Master Citizen Number) using regex

In this post, I will share my implementation of how to check if some number looks like EMBG or Unique Master Citizen Number. For those of yo...