Gossamer Forum
Home : General : Perl Programming :

case insensitive

Quote Reply
case insensitive
In would like to make the following routine case insensitive, so .doc, .DOC, .Doc, .Doc, .dOC will all pass. (and so on for .txt) Who can help me out?





Code:
my $attach_ext = '\.doc$|\.txt$';
if ($filename !~ /$attach_ext/) {
$attach_ext =~ s/\\//g;
$attach_ext =~ s/\$//g;
@ext = split (/\Q|\E/o,$attach_ext);
$attach_ext = join(" or ",@ext);
&site_html_request_error (" Only files with the following extension(s) are allowed: $attach_ext");
return;
}
Quote Reply
Re: case insensitive In reply to
Simple use \*$...wildcard character.

Regards,

Eliot Lee

Quote Reply
Re: case insensitive In reply to
Change:

/$attach_ext/

to:

/$attach_ext/i

the i means case insensitive.

Cheers,

Alex

--
Gossamer Threads Inc.