preg_match doesn't seem to work!

From: Date: Wed, 10 Apr 2002 22:01:55 +0000
Subject: preg_match doesn't seem to work!
Groups: php.general 
Request: Send a blank email to php-general+get-92461@lists.php.net to get a copy of this message
Hi everyone. I'm really banging my head against this one. Everything seems to be working, but this constructor method doesn't seem to want to pass. The error message I am getting is "you did not pass the preg_match()", so I'm clearly not passing the preg_match(). But I can't figure out why. // constructor, transforms a form field value into a file ID // which will be accepted by set_file_id() function FolderFile($value) { if (preg_match('/^folderfile\d+$/', $value)) { // transform the form field value into an acceptable // format for set_file_id() method (below) $value = str_replace("folderfile", "", $value); if (!$this->set_file_id($value)) { die("you passed the preg_match() but not the set_file_id() method"); return false; } else { return true; } } else { die("you did not pass the preg_match()"); return false; } } The code itself, which constructs this instance and calls the constructor method, is this: // $_GET['addtofolder'][0] = "folderfile1"; // $_GET['addtofolder'][1] = "folderfile2"; for ($i = 0; $i <= count($_GET['addtofolder']); $i++) { $ff_instance = new FolderFile($_GET['addtofolder'][$i]); $folderfile_list[] = $ff_instance->show_name(); unset($ff_instance); } So, I'm passing the constructor a value of "folderfile1", but that doesn't seem to work with my preg_match() (above). Yet it seems like it should work fine. Can anyone see what I'm doing wrong here? Thank you, Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com

« previous php.general (#92461) next »