Hi
I am developing a schema based XML Editor. For editing Simple types with pattern i am using a constrained editor that can take a pattern and restrain user from entering wrong input. when i try this pattern [0-9]{6} and try to enter any number the matchesPrefix() fails. you can also try it in the example. but if i use [0-9][0-9][0-9][0-9][0-9][0-9] then it works fine. can anyone please help. changing the expression is not an option.
thanks in advance
Iftekhar ahmed
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi-
You're misunderstanding what matchesPrefix does. It does not match the pattern against a prefix of the string, but instead matches the string against a prefix of the pattern. The pattern "[0-9]{6}" does not have any prefix shorter than 6 characters, while the other pattern has prefixes 1, 2, etc. characters long. The docs for the method show examples of this. Hope this helps.
Ulf
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That's a bug (sorry udittmer, you're wrong: it was intended to work just as Ahmed expects).
I fixed it way back then, and still not uploaded the right version yet (shame on me and stuff).
Contact me if you need it right now.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I am developing a schema based XML Editor. For editing Simple types with pattern i am using a constrained editor that can take a pattern and restrain user from entering wrong input. when i try this pattern [0-9]{6} and try to enter any number the matchesPrefix() fails. you can also try it in the example. but if i use [0-9][0-9][0-9][0-9][0-9][0-9] then it works fine. can anyone please help. changing the expression is not an option.
thanks in advance
Iftekhar ahmed
Hi-
You're misunderstanding what matchesPrefix does. It does not match the pattern against a prefix of the string, but instead matches the string against a prefix of the pattern. The pattern "[0-9]{6}" does not have any prefix shorter than 6 characters, while the other pattern has prefixes 1, 2, etc. characters long. The docs for the method show examples of this. Hope this helps.
Ulf
Hello ahmed!
That's a bug (sorry udittmer, you're wrong: it was intended to work just as Ahmed expects).
I fixed it way back then, and still not uploaded the right version yet (shame on me and stuff).
Contact me if you need it right now.