java - How to use quantifier regex pattern on blackberry ({m,n}) -
hi im trying write validation class using : regexp-me lib because of reply of post.
what did do
string id = "123456789"; string pattern = "\\d{7,8}"; public boolean validate(string id,string pattern){ re regular_expresion = new re("\\d{7,8}"); homecoming regular_expresion.match(id); } this code should have returned false "id" since pattern should take 7 8 digits. if utilize id = "1234567" homecoming true , code accepting 7 or more digits.
the {m,n} working {n,}.
has had problem before?
the look \\d{7,8} means:
this true 1234567 string of 7 digits 123456789 because string contains string 7 or 8 digits.
change look ^\\d{7,8}$ positive result when entire string origin end consists of digits , string length either 7 or 8.
java regex blackberry blackberry-eclipse-plugin
No comments:
Post a Comment