Anyone can help me derive a validation for French phone numbers, given the following:

String (max 255 chars)
French telephone formats (0123456789,
+33123456789, 0033123456789)


Recommended Answers

All 4 Replies

Are you looking for a Java-specific solution or something more general, eg a regular expression.
Are you just looking for the following rules:
( "0" OR "+33" OR "0033" ) followed by a non-zero digit, followed by exactly 8 digits, blanks to be ignored?
... if so it's the same pretty simple regex, whether you use that in Java or somewhere else.

In fact its more the regular expression which am looking for, but which will cater for the three formats posted earlier...

You could play with something like this, which is just those simple rules:

        String regex = "(0|\\+33|0033)[1-9][0-9]{8}";
        String data = "0512345678";
        System.out.println(data + " is " + Pattern.matches(regex, data));

thanks will try the code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.