Regex for US License Plate
Regex Pattern
^[A-Z0-9]{1,8}$US license plate — 1-8 uppercase alphanumeric characters
Quick Answer
The regex pattern for us license plate is `^[A-Z0-9]{1,8}$`. US license plate — 1-8 uppercase alphanumeric characters. This works in JavaScript, Python, Ruby, PHP, Java, and most regex engines that support PCRE syntax.
Test Examples
| Input | Result |
|---|---|
| ABC1234 | ✓ Matches |
| 7ABC123 | ✓ Matches |
| VANITY | ✓ Matches |
| abc1234 | ✗ No match |
| TOO-LONG-PLATE | ✗ No match |
| HAS SPACE | ✗ No match |
Code Examples
javascript
const regex = /^[A-Z0-9]{1,8}$/;
const isValid = regex.test(value);python
import re
pattern = r'^[A-Z0-9]{1,8}$'
if re.match(pattern, value):
print("valid")ruby
pattern = /^[A-Z0-9]{1,8}$/
if value =~ pattern
puts "valid"
endphp
if (preg_match('/^[A-Z0-9]{1,8}$/', $value)) {
echo "valid";
}java
String pattern = "^[A-Z0-9]{1,8}$";
boolean isValid = value.matches(pattern);Frequently Asked Questions
Related Regex Patterns
UUID v4
UUID version 4 (randomly generated)
UUID (Any Version)
Any RFC 4122 UUID (versions 1-5)
JWT Token
JSON Web Token (header.payload.signature)
Hex String
Any-length hexadecimal string
Base64 String
Standard base64 encoded string
Alphanumeric Username
Username with letters, digits, underscores (3-16 chars)