[wxPython-users] Re: Custom validator
Josiah Carlson
jcarlson at uci.edu
Tue Jan 2 14:31:07 PST 2007
Almost. If you use that regular expression, then a user who planned on
writing '.5' wouldn't be able to type the leading '.'. One could use
r'^(\d*\.\d*)$' with some post-processing afterwards to make it so that
an empty entry or just a plain '.' turns into a zero.
- Josiah
Lee Merrill <Lee.Merrill at bustech.com> wrote:
> How about r'(\d+|\d+\.\d*|\.\d+)$' ?
>
> Regards,
> Lee
>
> On Tue, 2007-01-02 at 21:46 +0600, Basil Shubin wrote:
>
> > Hi,
> >
> > Phil Mayes пиÑеÑ:
> > >
> > > Try:
> > > FLOAT = r'\d+\.\d+$'
> >
> > Not exactly what it should be. The problem is that I want check all
> > input char and 'allow' only digits, but all digits should fit the regex
> > pattern. For checking where is pressed key correspond the digits, is to
> > bind on wx.EVT_CHAR and than check if key is digit (it's showed in
> > wxPython validator example). But I don't know how I can check the entire
> > inputed string, so it fits regex pattern.
> >
>
>
> ---
> "There is nothing remarkable about it. All one has to do is press the
> right keys at the right time and the computer programs itself." (ala
> J.S. Bach)
>
> Unless otherwise stated, any views presented in this e-mail are solely
> those of the author and do not necessarily represent those of the
> company.
More information about the wxpython-users
mailing list