Contact
UAE Mobile Number Regex
Mobile numbers in the United Arab Emirates start with 5 after the country code, followed by an operator prefix digit and seven subscriber digits. Common prefixes are 50, 52, 54, 55, 56 and 58, and this pattern accepts those with either the domestic 0 or the +971 international prefix, plus optional spaces or dashes between groups. It is useful for delivery, real estate, banking and recruitment forms aimed at UAE residents. The honest limit is that operators occasionally open new prefixes, so review the allowed list over time.
Pattern (JavaScript)
/^(?:\+971[ -]?|0)5[024568][ -]?[0-9]{3}[ -]?[0-9]{4}$/Starts at the start of the line/string, then (the text "+971", then one of the characters -, optionally (zero or one time) OR the character "0"), then the character "5", then one of the characters 024568, then one of the characters -, optionally (zero or one time), then a digit, exactly 3 times, then one of the characters -, optionally (zero or one time), then a digit, exactly 4 times, then the end of the line/string.
Limit: Checks the format only; it cannot tell whether the number is active.
Examples
Matches
- ✓ +971 50 123 4567
- ✓ 0551234567
- ✓ +971-56-765-4321
Does not match
- ✗ 0511234567
- ✗ +971 4 123 4567
- ✗ 055123456
Try it
0 matches (JavaScript engine)
+971 50 123 4567
0551234567
+971-56-765-4321
0511234567
+971 4 123 4567
055123456Code in 8 languages
Converted automatically from the JavaScript pattern; language-specific notes are shown where the syntax or support differs.
JavaScript
const re = /^(?:\+971[ -]?|0)5[024568][ -]?[0-9]{3}[ -]?[0-9]{4}$/g;
const text = "+971 50 123 4567";
const matches = [...text.matchAll(re)].map((m) => m[0]);
console.log(matches);Python
import re
pattern = re.compile(r'^(?:\+971[ -]?|0)5[024568][ -]?[0-9]{3}[ -]?[0-9]{4}$')
text = '+971 50 123 4567'
matches = [m.group(0) for m in pattern.finditer(text)]
print(matches)PHP
<?php
$pattern = '/^(?:\+971[ -]?|0)5[024568][ -]?[0-9]{3}[ -]?[0-9]{4}$/';
$text = '+971 50 123 4567';
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("^(?:\\+971[ -]?|0)5[024568][ -]?[0-9]{3}[ -]?[0-9]{4}$");
String text = "+971 50 123 4567";
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
System.out.println(matcher.group());
}
}
}Go
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`^(?:\+971[ -]?|0)5[024568][ -]?[0-9]{3}[ -]?[0-9]{4}$`)
text := "+971 50 123 4567"
fmt.Println(re.FindAllString(text, -1))
}C#
using System;
using System.Text.RegularExpressions;
var pattern = new Regex(@"^(?:\+971[ -]?|0)5[024568][ -]?[0-9]{3}[ -]?[0-9]{4}$");
var text = "+971 50 123 4567";
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"^(?:\+971[ -]?|0)5[024568][ -]?[0-9]{3}[ -]?[0-9]{4}$").unwrap();
let text = "+971 50 123 4567";
for m in re.find_iter(text) {
println!("{}", m.as_str());
}
}- Add regex = "1" under [dependencies] in Cargo.toml.
Ruby
pattern = /^(?:\+971[ -]?|0)5[024568][ -]?[0-9]{3}[ -]?[0-9]{4}$/
text = '+971 50 123 4567'
matches = text.to_enum(:scan, pattern).map { Regexp.last_match[0] }
p matchesFrequently asked questions
- Why does the pattern reject 04 numbers?
- Numbers starting with 04 are Dubai landlines, not mobiles. This pattern is meant for mobile-only fields such as SMS verification, so landlines are intentionally excluded.
- What if a new mobile prefix is introduced?
- Add the new digit to the [024568] class. Keeping the prefix list explicit makes it easy to update in one place.
- Can I accept 00971 instead of +971?
- Yes, change the first group to (?:\+971|00971)[ -]?|0 or convert 00 to + before testing. Normalising first keeps the pattern simpler.