Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 58612 invoked from network); 25 Apr 2010 02:39:35 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 25 Apr 2010 02:39:35 -0000 Received: (qmail 11588 invoked by uid 500); 25 Apr 2010 02:39:34 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 11389 invoked by uid 500); 25 Apr 2010 02:39:32 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 11382 invoked by uid 99); 25 Apr 2010 02:39:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Apr 2010 02:39:31 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [64.85.161.47] (HELO b03ls15le.corenetworks.net) (64.85.161.47) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Apr 2010 02:39:22 +0000 Received: from freedom2.my.domain (cpe-72-177-54-134.austin.res.rr.com [72.177.54.134]) by b03ls15le.corenetworks.net (8.14.3/8.14.3) with ESMTP id o3P2cwHt026307 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO) for ; Sat, 24 Apr 2010 21:39:00 -0500 (CDT) Message-ID: <4BD3AB3D.1040900@bennettconstruction.biz> Date: Sat, 24 Apr 2010 21:38:53 -0500 From: Chris Bennett Reply-To: chris@bennettconstruction.biz Organization: Bennett Construction User-Agent: Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.9.1.9) Gecko/20100416 Thunderbird/3.0.4 MIME-Version: 1.0 To: modperl@perl.apache.org Subject: Getting a / when regex should produce nothing Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org When I run this first time, with no values from form, I get $article_file being a / when it should be nothing. I just can't see the error. I have tried variations with \w and dash at beginning and end, but no go. Debug shows blank at A, / at B #!/usr/bin/perl $VERSION = 1.0.0; use warnings; no warnings 'uninitialized'; use strict; #use Apache::Constants qw(:common); use Apache::Request(); #use Apache::Cookie(); use MyPerl::Articulator qw(get_template print_template print_text submit_changes backup_server see_html template_form load_template); our $debug = 1; delete $ENV{PATH}; my $r = Apache->request; my $q = Apache::Request->new($r, POST_MAX => 1000000, DISABLE_UPLOADS => 1); my $site_url = "www.example.com"; my $site_directory = "/var/www/htdocs/users/example.com"; my $site_name = "Example!"; my $secure = 1; my $article_directory = "articles"; undef my $error; undef my $article_title; undef my $article_backup_file; undef my $article_file; $article_file = $q->param("articlefilename"); if ($debug) { $error .= qq{

$article_file

};} $article_file =~ m/^([a-zA-Z0-9_-]*\.html)$/; $article_file = $1; if ($debug) { $error .= qq{

$article_file

};} $article_backup_file = $article_file; $article_backup_file =~ s/\.html$/_backup.html/; undef my $body; Thanks Chris Bennett -- A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. -- Robert Heinlein