Hy
I want to validate expression as such:
AO:10
EM:1
IO:102
AO:SA
EM:SA,AKA,LLMN
so on...
I'm noe to Regex and i came out with the following function:
public void checkFormat(String line) {
String expression = "^[ACEILMNOU.]{2}+\\B[:]{1}+\\w{2,4}+";
Pattern subscriptionExpretion = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
Matcher matcher = subscriptionExpretion.matcher(line);
if(matcher.matches()) {
System.out.println("matches " + line);
} else {
System.out.println("doesn't match " + line);
}
}
witch doesn't work... anyone has a clue on how to make it work?
Thank you