DD
DevDash

Regex for UK Phone Number

Regex Pattern

^(?:\+44|0)7\d{9}$

UK mobile number with optional +44 country code

Quick Answer

The regex pattern for uk phone number is `^(?:\+44|0)7\d{9}$`. UK mobile number with optional +44 country code. This works in JavaScript, Python, Ruby, PHP, Java, and most regex engines that support PCRE syntax.

Test Examples

InputResult
07123456789✓ Matches
+447123456789✓ Matches
+44 7123456789✓ Matches
07123✗ No match
+15551234567✗ No match
00447123456789✗ No match

Code Examples

javascript

const regex = /^(?:\+44|0)7\d{9}$/;
const isValid = regex.test(value);

python

import re
pattern = r'^(?:\+44|0)7\d{9}$'
if re.match(pattern, value):
    print("valid")

ruby

pattern = /^(?:\+44|0)7\d{9}$/
if value =~ pattern
  puts "valid"
end

php

if (preg_match('/^(?:\+44|0)7\d{9}$/', $value)) {
    echo "valid";
}

java

String pattern = "^(?:\\+44|0)7\\d{9}$";
boolean isValid = value.matches(pattern);

Frequently Asked Questions

Related Regex Patterns

Want API access + no ads? Pro coming soon.