Identity
UAE Emirates ID Shape Regex
The UAE Emirates ID number has fifteen digits and is usually printed as 784-YYYY-NNNNNNN-C. The prefix 784 is the ISO numeric code for the United Arab Emirates, the next four digits are commonly a year, then come seven serial digits and a final check digit. This pattern accepts the number with or without dashes, which helps telecom, banking, rental and HR forms in the UAE. The limit is that it cannot confirm the year is plausible or that the check digit is correct, so treat a match as a format pass only.
Pattern (JavaScript)
/^784-?[0-9]{4}-?[0-9]{7}-?[0-9]$/Starts at the start of the line/string, then the text "784", then the character "-", optionally (zero or one time), then a digit, exactly 4 times, then the character "-", optionally (zero or one time), then a digit, exactly 7 times, then the character "-", optionally (zero or one time), then a digit, then the end of the line/string.
Limit: Checks the shape only; it cannot tell whether a document is real or valid.
Examples
Matches
- ✓ 784-1990-1234567-1
- ✓ 784199012345671
- ✓ 784-1985-7654321-0
Does not match
- ✗ 785-1990-1234567-1
- ✗ 784-1990-123456-1
- ✗ 784-90-1234567-1
Try it
0 matches (JavaScript engine)
784-1990-1234567-1
784199012345671
784-1985-7654321-0
785-1990-1234567-1
784-1990-123456-1
784-90-1234567-1Code in 8 languages
Converted automatically from the JavaScript pattern; language-specific notes are shown where the syntax or support differs.
JavaScript
const re = /^784-?[0-9]{4}-?[0-9]{7}-?[0-9]$/g;
const text = "784-1990-1234567-1";
const matches = [...text.matchAll(re)].map((m) => m[0]);
console.log(matches);Python
import re
pattern = re.compile(r'^784-?[0-9]{4}-?[0-9]{7}-?[0-9]$')
text = '784-1990-1234567-1'
matches = [m.group(0) for m in pattern.finditer(text)]
print(matches)PHP
<?php
$pattern = '/^784-?[0-9]{4}-?[0-9]{7}-?[0-9]$/';
$text = '784-1990-1234567-1';
preg_match_all($pattern, $text, $matches);
print_r($matches[0]);Java
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
Pattern pattern = Pattern.compile("^784-?[0-9]{4}-?[0-9]{7}-?[0-9]$");
String text = "784-1990-1234567-1";
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
System.out.println(matcher.group());
}
}
}Go
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`^784-?[0-9]{4}-?[0-9]{7}-?[0-9]$`)
text := "784-1990-1234567-1"
fmt.Println(re.FindAllString(text, -1))
}C#
using System;
using System.Text.RegularExpressions;
var pattern = new Regex(@"^784-?[0-9]{4}-?[0-9]{7}-?[0-9]$");
var text = "784-1990-1234567-1";
foreach (Match m in pattern.Matches(text))
{
Console.WriteLine(m.Value);
}Rust
// Cargo.toml: regex = "1"
use regex::Regex;
fn main() {
let re = Regex::new(r"^784-?[0-9]{4}-?[0-9]{7}-?[0-9]$").unwrap();
let text = "784-1990-1234567-1";
for m in re.find_iter(text) {
println!("{}", m.as_str());
}
}- Add regex = "1" under [dependencies] in Cargo.toml.
Ruby
pattern = /^784-?[0-9]{4}-?[0-9]{7}-?[0-9]$/
text = '784-1990-1234567-1'
matches = text.to_enum(:scan, pattern).map { Regexp.last_match[0] }
p matchesFrequently asked questions
- Why does every Emirates ID start with 784?
- 784 is the ISO 3166 numeric country code for the United Arab Emirates. Requiring it rejects many numbers that belong to other systems or were typed incorrectly.
- Can the dashes be mixed, for example only some of them?
- Yes, each dash is optional on its own, so partially dashed input still matches. Normalise by removing dashes before storing if you need one consistent format.
- Is the final digit a checksum?
- The last digit is widely reported to be a check digit based on the Luhn algorithm. A regex cannot compute it, so add a Luhn check in code if you need that extra safety.