| CGI-ValidOp documentation | Contained in the CGI-ValidOp distribution. |
CGI::ValidOp::Check::text - CGI::ValidOp::Check module to validate text
Fails if incoming value contains characters other than Perl's character classes \w, \s, and: ! " ' ( ) * , - . / : ; ? @ \
Fails if value contains anything other an Perl's "word" character class ([a-zA-Z0-9_]).
Like word above, but can contain spaces as well.
Expands on default allowing $ = ~ +
Even more permissive than liberal, including # { } [ ] ^ _ $
Still does not allow <tags> to be embedded though...
Randall Hansen <legless@cpan.org>
Copyright (c) 2003-2005 Randall Hansen. All rights reserved.
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
| CGI-ValidOp documentation | Contained in the CGI-ValidOp distribution. |
package CGI::ValidOp::Check::text; use strict; use warnings; use base qw/ CGI::ValidOp::Check /; sub default { ( qr#^[\w\s\(\*\.\\\?,!"'/:;@&%)-]+$#, q#Only letters, numbers, and the following punctuation are allowed for $label: ! " ' ( ) * , - . / : ; ? \ @ & %#, ) } sub word { ( qr/^\w+$/, q#Only one word is allowed for $label#, ) } sub words { ( qr/^[\w -]+$/, q#Only words are allowed for $label#, ) } sub liberal { ( qr#^[\w\s\(\*\.\\\?,!"'/:;&=%~\+\@\$)\#-]+$#, q|Only letters, numbers, and the following punctuation are allowed for $label: ! " ' ( ) * , - . / : ; & = % ~ + ? \ @ $ #|, ) } sub hippie { ( qr{^[\w\s\(\*\.\\\?#,{}^_[\]!"'/:;&=%~\+\@\$)-]+$}, q{Only letters, numbers, and the following punctuation are allowed for $label: ! " ' ( ) * , - . / : ; & = % ~ + ? \ @ # { } [ ] ^ _ $}, ) } 1; __END__
# $Id: text.pm 75 2005-01-14 05:49:20Z soh $