I hate to say it but that didn't work, I have been trying different
variations of the same ereg('_(^90-9{4}$).jpg$',$file_names) and nothing
seems to work for me, I have also been looking at the ereg and preg_ereg
functions but they don't seem to make sense to me, here is the code as a
whole if this helps:
// query directory and place results in select box
$dir_name = "/path/to/images/directory/on/server/"; // path to directory on
server
$dir = opendir($dir_name); // open the directory in question
$file_lost .= "<p><FORM METHOD=\"post\" ACTION=\"done.php3\" NAME=\"ad01\">
<SELECT NAME=\"image_path\">";
 while ($file_names = readdir($dir)) {
  if ($file_names != "." && $file_names !=".." && ereg('_(^[0-9]{4}.jpg$)',
$file_names)) // filter my contents
 {
  $file_lost .= "<OPTION VALUE=\"$file_names\"
NAME=\"$file_names\">$file_names</OPTION>";
  }
 }
 $file_lost .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\"
VALUE=\"select\"></FORM></p>";
 closedir($dir);
What I am trying to accomplish is to list the contents of a directory in
select box but I want to filter out any files that dont meet this criteria
*_4444.jpg and nothing is working for me, any help or good tutorials on
strings would be great.
Jas
"Erik Price" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> On Thursday, April 11, 2002, at 05:59  AM, jas wrote:
>
> > Is this a correct string to show only files that look like so:
> > *_2222.jpg
> > if ($file_names != "." && $file_names !=".." &&
> > ereg('(^[0-1231]$).jpg$',$file_name))
> > Any help would be great.
>
> preg_match(/^_[0-9]{4,4}\.jpg$/, $file_name) should match any string
> that starts with an underscore, is followed by exactly four digits, and
> then a ".jpg".  It will not match anything but this exact string.
>
>
> Erik
>
>
>
>
> ----
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to