I'm building an application in Codenameone (Java) and need a quick email check with regex.
But now for some reason whenever I build my app I get the error that the java.util.regex package does not exist.
Netbeans gives no errors when compiling and I can access the sourcecode from all the classes in java.util.regex but for some reason netbeans can not find it when building.
I did some searching on the web but could not find anything of use.
I use Netbeans 7.4 and JDK 7 (JRE 1.7.0_51)
This is the code for the mail check:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
protected boolean checkMail(String email) {
String EMAIL_PATTERN
= "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
Pattern pattern = Pattern.compile(EMAIL_PATTERN);
Matcher matcher = pattern.matcher(email);
return matcher.matches();
}
This is the error i get:
F:\Pantera\Documents\NetBeansProjects\TherapieApp\src\be\pantera\TherapieApp\RegisterPage.java:25: error: package java.util.regex does not exist import java.util.regex.Matcher;
F:\Pantera\Documents\NetBeansProjects\TherapieApp\src\be\pantera\TherapieApp\RegisterPage.java:26: error: package java.util.regex does not exist import java.util.regex.Pattern;
--EDIT-- Seems this problem is related to codenameone so i changed the title. Thank you to those who answered before the edit. I didn't think the problem could be related to Codenameone, my apologies.