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
| Input | Result |
|---|---|
| 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"
endphp
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
US Phone Number
US phone number in common formats
International Phone (E.164)
Validates E.164 international format — + followed by 2-15 digits
Indian Phone Number
Indian mobile number with optional +91 country code
Email Address
Validates a standard email address format
Email (RFC 5322 Compliant)
RFC 5322 compliant email validation with label length limits
URL (HTTP/HTTPS)
Validates HTTP and HTTPS URLs