VIN (Vehicle Identification Number) Regex Pattern
Validates 17-character Vehicle Identification Numbers excluding I, O, and Q which can be confused with 1 and 0.
Live Regex Tester
Pattern Breakdown
Code Examples
JavaScript
const regex = /^[A-HJ-NPR-Z0-9]{17}$/;
const test = "1HGBH41JXMN109186";
console.log(regex.test(test)); // true
// Extract matches
const matches = test.match(regex);
console.log(matches);Python
import re
pattern = r'^[A-HJ-NPR-Z0-9]{17}$'
test = "1HGBH41JXMN109186"
match = re.search(pattern, test)
print(match) # Found!Go
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`^[A-HJ-NPR-Z0-9]{17}$`)
fmt.Println(re.MatchString("1HGBH41JXMN109186")) // true
}Common Use Cases
Match Examples
| Input | Result |
|---|---|
| 1HGBH41JXMN109186 | Match |
| AAABBB1234 | No Match |
About the VIN (Vehicle Identification Number) Regex
Validates 17-character Vehicle Identification Numbers excluding I, O, and Q which can be confused with 1 and 0.
Regular expressions (regex) are powerful pattern matching tools used across virtually all programming languages. The vin (vehicle identification number) pattern is classified as intermediate difficulty in the identity & documents category. It works in all major programming languages.
When using this regex, always consider edge cases and test thoroughly with real-world data. Use the interactive tester above to validate the pattern against your specific inputs before deploying to production.
More Identity & Documents Patterns
Need More Regex Patterns?
Browse our complete library of 100+ regex patterns with interactive testers.
Frequently Asked Questions
What is the VIN (Vehicle Identification Number) regex pattern?
Validates 17-character Vehicle Identification Numbers excluding I, O, and Q which can be confused with 1 and 0.
How do I use the VIN (Vehicle Identification Number) regex?
Use the pattern /^[A-HJ-NPR-Z0-9]{17}$/ in your code. In JavaScript: new RegExp('^[A-HJ-NPR-Z0-9]{17}$', ''). Test it above with your own input.
What does this VIN (Vehicle Identification Number) regex match?
This pattern matches: "1HGBH41JXMN109186". It does NOT match: "AAABBB1234". Automotive, insurance, vehicle registration, fraud detection.
Is the VIN (Vehicle Identification Number) regex beginner-friendly?
This pattern is rated Intermediate. It uses some advanced features like character classes and quantifiers.
What languages support the VIN (Vehicle Identification Number) regex?
This pattern works in all major programming languages including JavaScript, Python, Java, C#, Go, Ruby, PHP, and more. Syntax may vary slightly between regex engines.
Can I modify the VIN (Vehicle Identification Number) regex for my use case?
Yes! Use the interactive tester above to modify the pattern and test with your own data. Common modifications include making it case-insensitive (add 'i' flag), matching globally (add 'g' flag), or adjusting character classes.
Related Tools
Social Security Number (US) Regex
Beginner Identity & Documents pattern
US Zip Code Regex
Beginner Identity & Documents pattern
US State Code Regex
Intermediate Identity & Documents pattern
UK Postcode Regex
Intermediate Identity & Documents pattern
Canadian Postal Code Regex
Beginner Identity & Documents pattern
Passport Number Regex
Beginner Identity & Documents pattern