I need help to set up a regular expression of 12 charaters. The first 7 characters must be alpha characters and the 5 remaining characters must be numeric. Below is my line of code
Pattern numberPattern = Pattern.compile( "[a-zA-Z]{7}[0-9]{5}" );
Can somebody fix that for me because it's not working... :-(
Thanks
I passed 13 characters but it returned true. I would like this code to return false every time orderNumber is not 12 characters. Also the first 7 characters must be alpha characters and the five remaining must be digit.
Thanks
I passed 13 characters but it returned true. I would like this code to return false every time orderNumber is not 12 characters. Also the first 7 characters must be alpha characters and the five remaining must be digit.
Thanks
Use the matches() method instead. Take a look at the JavaDoc (java.util.regex.Matcher) to see why.