Menu

partial Match

Help
2005-01-13
2013-06-12
  • Nobody/Anonymous

    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

     
    • Ulf Dittmer

      Ulf Dittmer - 2005-03-21

      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

       
    • Sergey A. Samokhodkin

      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.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.