German Phone Number
intermediateMatches German phone numbers with optional country code.
phonegermanyvalidation
Pattern
/(?:\+49[\s-]?|0)\d{2,5}[\s-]?\d{3,}[\s-]?\d{0,4}/gTry It
0 of 6 strings matched
Explanation
Matches German phone numbers starting with +49 or 0, with variable-length area codes (2-5 digits) and subscriber numbers.
Test Strings
Matching
- +49 30 12345678
- 030 12345678
- +49-89-123456
Non-matching
- +1-555-1234
- 12345
- abc
Language Compatibility
| Language | Support |
|---|---|
| JS | Full support |
| PYTHON | Full support |
| JAVA | Full support |
| PHP | Full support |
| GO | Full support |
Code Snippets
const regex = /(?:\+49[\s-]?|0)\d{2,5}[\s-]?\d{3,}[\s-]?\d{0,4}/g;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);