validate phone number before saving
<p>I have here a code to validate a phone number</p>

<pre><code>public class ValidatePhoneNumber {

    public static void main(String[] argv) {

        String phoneNumber = "1-(80..2)-321-0361";
        System.out.println(phoneNumber.length());
        String regex = "^\\+?[0-9. ()-]{10,25}$";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(phoneNumber);

        if (matcher.matches()) {
            System.out.println("Phone Number Valid");
        } else {
            System.out.println("Phone Number must be in the form XXX-XXXXXXX");
        }
    }
}
</code></pre>

<p>How can i put this code inside the SAVEBUTTON ACTION?</p>

<pre><code>private void saveButton3ActionPerformed(java.awt.event.ActionEvent evt) {...}
</code></pre>

<p>to prevent the user for saving invalid phone number format</p>

<p>THANK YOU!</p>
