In the following code, the RegexConstraint doesn't work, because the phone number results always incorrect. What's wrong? I need to check a mobile phone number (without the country code). For example, the input 3652312453 should be correct, but in the following code it's evaluated as incorrect. I copied the regex from the discussion linked in the comment: my only requirement is a valid phone number.
(Note: this question is not for generic Java, but only for Codename One. The class "CountryCodePicker" extends the class "Button": I reported it to make it clear that the phone number and the country code are separated)
    TextModeLayout tl = new TextModeLayout(1, 1);
    Container loginContainer = new Container(tl);
    TextComponent phone = new TextComponent().label("PHONE").errorMessage("INVALID-PHONE");
    CountryCodePicker countryCode = new CountryCodePicker();
    phone.getField().setConstraint(TextArea.PHONENUMBER);
    loginContainer.add(phone);
    Container loginContainerWithCodePicker = new Container(new BoxLayout(BoxLayout.X_AXIS_NO_GROW));
    loginContainerWithCodePicker.add(countryCode).add(loginContainer);
    // https://stackoverflow.com/questions/8634139/phone-validation-regex
    String phoneRegEx = "/\\(?([0-9]{3})\\)?([ .-]?)([0-9]{3})\\2([0-9]{4})/";
    val.addConstraint(phone, new RegexConstraint(phoneRegEx, "NOT-VALID-NUMBER"));
    Button loginButton = new Button("LOG-IN");
    val.addSubmitButtons(loginButton);
 
     
    