How to validate south korean personal custom clearance code (PCCC) using javascript/jquery?

Hi Experts,
I tried every means to figure out the validation for south Korean "Personal Custom Clearance Code" (PCCC). I didn't find enough resources about it other than some blog and articles about requirement of pcc code as mandatory for importing. PCCC is the code that is used for clearing the custom if someone is buying stuffs/products internationally. It is like ssn in the USA having 13 digits in total starting with letter "P". For example: P123451234512. I am not sure if I could ask this kind of question here but if someone knows about it, that would be nice.  All I did till now is I validated a text box for PCCC by length=13 under html. Is there anyone who know how to validate the PCC code using javascript?

<fieldset>
      <legend>Validate korean PCCC</legend>
      <div style= "padding-top:15px;">
            <label style= "padding: 20px; font-size: 16px; font-weight:600; color: #AA6903;">Personal Custom Clearance Code: </label>
            <input type="text" id="inputcpf" name="pccc" size="13" maxlength="13" autofocus>
            <input type="button" style= "margin-top:10px;" class="btnchec" name="Submit" value="Check">
      </div>
</fieldset>

Thank you
Bade011Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee SavidgeCommented:
Well, use a regex.

<body>
<script>
function checkPCCC(psPCCC)
{
    if(psPCCC.match(/^[A-Za-z][0-9]+$/))
       alert('match');
    else
        alert('no match');
}
    </script>
    <fieldset>
      <legend>Validate korean PCCC</legend>
      <div style= "padding-top:15px;">
            <label style= "padding: 20px; font-size: 16px; font-weight:600; color: #AA6903;">Personal Custom Clearance Code: </label>
            <input type="text" id="inputcpf" name="pccc" size="13" maxlength="13" autofocus>
            <input type="button" style= "margin-top:10px;" class="btnchec" name="Submit" value="Check" onclick=checkPCCC(document.getElementById("inputcpf").value)>
      </div>
</fieldset>
          </body>

Open in new window


See it working here: https://jsfiddle.net/x0rqn5xL/
Lee SavidgeCommented:
If you want case sensitive, then put:

if(psPCCC.match(/^[A-Z][0-9]+$/))

According to here: http://awarekorea.com/knowledge-base/personal-customs-clearance-code/

It says the format is "The Personal Customs Clearance Code is typically formed by one letter and 12 digits. Example: P123456789012"

It doesn't specifically state it is a P followed by 12 numbers. If it is always a P, then you could just ask that the user enter just the numberic part of the PCCC and limit the input to 12 digits and make the regex this:

if(psPCCC.match(/^[0-9]+$/))
Bade011Author Commented:
So ya since there is no format for this code (atleast I couldn't find since 2 days of research), I was thinking, can any number be acceptable for PCCC or there is some kind of secret governmental algorithm or logic for it. for eg: when I tried P123451234512 in some kind of website, it says its incorrect. so i was wondering how and what kind of validation that website used?
https://secure.iherb.com/transactions/checkout one has to create account to check this url.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Lee SavidgeCommented:
From what I read, the PCCC isn't required as you can use your passport number instead, but it replaces 2 other codes which I can't recall the name of now, other than one had the word "alien" in it.

As this change seems to have happened in January 2015, it doesn't look like it's been widely taken up, so you may need to question whether it's worth spending the time developing something for little or no return.

Obviously I don't know your need for this other than what you said in the quetion. I couldn't see any format for the code either.
Bade011Author Commented:
Actually, PCC code is mandatory for the citizens and for foreigners (living their temporarily) passport number and alien registration numbers are asked. Talking about my need for this project, our Korean customers aren't getting their orders on the time due to lack of their PCC code during custom clearing. Therefore, I have been trying to add PCC validation code and planning to ask our Korean customers' PCC code. But as I mentioned earlier,I couldn't find any help on the internet. It might be because its just implemented as you mentioned. Thank you Mr Lee Savidge for your help. I really appreciate it.
Lee SavidgeCommented:
Maybe discuss with one of your key Korean customers and explain the difficulty you're having and they could assist you in finding the official format. Or speak to a Korean embassy official and see what the business requirements are with regards to the PCCC.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.