in reply to Re^2: Stopping bad input (harder than sanitizing)
in thread Stopping bad input (harder than sanitizing)
You could use a character class to accept : and - in the validatecommand sub.
'-validatecommand' => sub {$_[1] =~/[\w:-]+/ ;} ,
WRT your invalidcommand sub, the regexp does nothing at the moment. Should the first line be something like this if you want to accept control characters?
'-invalidcommand' => sub { return if $_[1] =~/^[[:cntrl:]] ; $top -> bell; }
Or do you want the bell if it starts with a control character?
'-invalidcommand' => sub { $top -> bell if $_[1] =~/^[[:cntrl:]] ; }
I don't code with Tk, but hopefully this is useful.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Stopping bad input (harder than sanitizing)
by Anonymous Monk on Mar 10, 2021 at 18:11 UTC | |
by hippo (Archbishop) on Mar 10, 2021 at 18:48 UTC | |
by tybalt89 (Monsignor) on Mar 10, 2021 at 19:08 UTC | |
|
Re^4: Stopping bad input (harder than sanitizing)
by Anonymous Monk on Mar 10, 2021 at 17:42 UTC |