Regular Expression Help
| From: | Alex Augot | Date: | Fri, 18 Aug 2000 19:51:35 +0000 |
| Subject: | Regular Expression Help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12528@lists.php.net to get a copy of this message | ||
Hi ya,
I'm having some trouble with regular expressions using the
eregi() function. I'm a newbie, not to php, but just to regular
expressions in general.
What I'm trying to do is print out an option list of only 777 'moded
files
with .php3 extensions. The "33279" is just what 0777 in octal(?) prints
out as in base 10. I didn't have the energy to convert it, and it works
fine.
<?php
if(!isset($requested_dir)) { $requested_dir = "."; }
$current_directory = opendir($requested_dir);
while ($entry_name = readdir($current_directory))
{
if(is_file($entry_name))
{
$chmod_number = fileperms($entry_name);
if($chmod_number == "33279")
{
if(eregi("^[[:>:]]/.php3$", $entry_name))
{
print("<option>$entry_name</option>\n");
}
}
}
}
print("</select>\n");
?>
As you can see, my regular expression is screwed up. I've looked in
2 books ( Core PHP and Programming Browser Based Applications
in PHP3 ) and they both really glossed over the subject of regular
expressions.
Basically, I just need the regular expression code that would take a
string ( test.php3 ) for example, and just check for the .php3
extension.
Thanks in advance
-Alex
--
Alex Augot ex.3065
Software Process Engineering Group
Teradyne, Inc
Phone: 617-422-3065
Cell: 617-435-7035