|
Posted by Dave M on 11/14/05 19:01
In article <dla9ra$19oe$1@fegnews.vip.hr>, g0c says...
>
>hi all,
>i really cannot find a simple exmaple for preg_match function
>
>i whiled the files in the directory ...
>
>$d = dir('.') or die($php_errormsg);
>while (false !== ($f = $d->read())) {
> if (is_file($d->path.'/'.$f)) {
> if (preg_match(match????,substr($f,3))) {
> // print '<option> ' . $f . '<option>';
> echo "$f\n";
> }
> }
>}
>$d->close();
>
>i want to include files begining with "tn_"
>what in the heck must stand in pattern position, i tried everything ,
>nothing worked
>i have actually 8 files starting with tn_* of course ...
>
>thanks
>
>
I think you use a regular express in place of "match????,". Such as..
$match = '/pattern to match/'
if (preg_match($match, substr($f,3))) {
}
Dave
--
Basic Newsguy - 3 GB / month - $39.95 / year
http://newsguy.com/overview.htm
Navigation:
[Reply to this message]
|