Download Cheat sheet PDF 12 pages · syntax, editors, patterns, Unicode, performance, debugging
Pattern

Regex for French phone (+33)

French phone with +33 prefix.

The pattern

^\+33[\s\-]?[1-9](\s?\d{2}){4}$
Try in explainer →

What it matches

  • +33 1 23 45 67 89
  • +33-6-12-34-56-78
  • +33612345678

What it doesn't match

  • +33 0 23 45 67 89
  • 01 23 45 67 89
  • +1 555 5555

Notes & gotchas

French phone: +33 + 1 digit (1=Paris, 6=mobile, 7=mobile, 9=VoIP, etc.) + 8 more digits, typically grouped in pairs. The leading 0 is dropped after the country code.

Code in your language

Use the explainer's Code tab to generate ready-to-paste snippets in JavaScript, Python, Java, .NET, Go, Ruby, and PHP for this pattern.

Open in explainer →

About this pattern

European Union identifiers follow standards set by individual member states with EU-wide coordination (VAT VIES, IBAN/SEPA, etc.). The regex validates structure; for production use, validate via the appropriate registry.

Quick usage in different languages

Once you've validated a candidate value matches this pattern, you'll typically use it inside your application code. Each language has its own regex syntax:

  • JavaScript: new RegExp(pattern).test(value) or /pattern/.test(value)
  • Python: re.match(pattern, value) with raw strings: r"pattern"
  • Java: Pattern.compile(pattern).matcher(value).matches()
  • C# / .NET: Regex.IsMatch(value, pattern)
  • Go: regexp.MustCompile(pattern).MatchString(value) — Go uses RE2 so some advanced features aren't available
  • Ruby: value =~ /pattern/ or pattern.match?(value)
  • PHP: preg_match('/pattern/', $value)

The explainer's Code tab generates these for any pattern you paste — including the right escaping and idioms for each language.

Common pitfalls

  • Anchors matter. The pattern starts with ^ and ends with $ — it expects the entire input to match. To find this pattern inside a longer text, remove the anchors and use the /g flag for multiple matches.
  • Case sensitivity. Letter ranges like [A-Z] only match uppercase. Use the i flag or [A-Za-z] for case-insensitive matching.
  • Escape user input. If you're building a regex from a string variable, escape regex metacharacters first to avoid bugs or injection — use RegExp.escape-equivalents in your language.
  • Performance. For this specific pattern the risk is low, but be cautious of nested quantifiers when adapting it — they can cause exponential backtracking on adversarial input.

See also

Browse all 300 patterns in the library, or open this regex in the interactive explainer to see a token-by-token breakdown, test against custom input, and generate code in seven languages.


← Back to all patterns