Jump to content

Regex country check for custom fields


qjul

Recommended Posts

We've got a domain registration module for the Swedish .SE TLD. It requires that all registrants supply a personal / company ID number. So we've added a custom field for this. So far so good.

 

The crux is, that the format can be different depending on where the registrant is based. For anyone in Sweden, it has to be ten digits, no spaces or anything else. For Sweden, it seems I could add something like:

 

/^[0-9]{10}$/i

 

The problem is, I just want to require this 10 digit code for Swedish registrants, anyone else can put a more freeform ID in there.

 

I need to check this when creating a new account, as it'll be used to auto-process the domain registration and it'll fail if the ID is incorrect.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated