I thought I had the correct syntax but it doesn't seem to be working.
Could someone lend me some eyes
import java.util.regex.*;
public class elevenDigitVariable {
public static void main(String[] args) {
try {
String billId = "21233343430";
Pattern p = Pattern.compile("[\\d{11}]");
Matcher m = p.matcher(billId);
StringBuffer sb = new StringBuffer();
boolean result = m.find();
boolean deletedIllegalChars = false;
while(result) {
deletedIllegalChars = true;
result = m.find();
}
if (deletedIllegalChars)
System.out.println("Invalid Bill ID: "+billId);
else
System.out.println("Valid Bill ID: "+billId);
}
catch (Exception ex) {
System.out.println(ex);
}
}
}