It is for sure possible to do exactly what you want with a regexp. Why bother with implementing the logic by hand, this is exactly what regexes are good for.
You can try a Google search for "regex money format". The following is adapted from http://www.codingforums.com/archive/index.php/t-20247.html ^(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$ and matches currency format with lead dollar sign. Dollar value must have at least one digit and may or may not be comma separated. Cents value is optional (according to the above website, I didn't verify it). Or look at http://stackoverflow.com/questions/354044/what-is-the-best-u-s-currency-regex Cheers, Fritz P.S.: Be warned, there are a lot of poor regex examples around, so make sure it does what you REALLY need, especially edge cases (which would probably be a problem also if you implement it yourself). On Mon, 8 Aug 2011, alexandr wrote: > Thanks a lot, Gabriel! > > You example match case [digits-dot-digits], but not [digits-dot-2_digits]... > And, for user, it is better if the programm does not allow to input wrong > characters, but not only highlight wrong input... > So I try to find the way, how to restrict input in textfield, depending on > the current value in textfield... > > Cheers, > Alexander > > -- > View this message in context: > http://qooxdoo.678.n2.nabble.com/Keyinput-event-tp6663993p6664224.html > Sent from the qooxdoo mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > The must-attend event for mobile developers. Connect with experts. > Get tools for creating Super Apps. See the latest technologies. > Sessions, hands-on labs, demos & much more. Register early & save! > http://p.sf.net/sfu/rim-blackberry-1 > _______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > -- Oetiker+Partner AG tel: +41 62 775 9903 (direct) Fritz Zaucker +41 62 775 9900 (switch board) Aarweg 15 +41 79 675 0630 (mobile) CH-4600 Olten fax: +41 62 775 9905 Schweiz web: www.oetiker.ch ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
