![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 510 Pomógł: 1 Dołączył: 27.08.2007 Ostrzeżenie: (0%) ![]() ![]() |
witam
istnieje jakis sposob, aby pobrac nazwy plikow za pomoca funkcji glob, filtrujac nazwy za pomoca eregi ? potrzebuje pobrac nazwy, ktore nie maja w sobie przykladowo slowa: 'foto'; |
|
|
![]()
Post
#2
|
|
![]() Grupa: Moderatorzy Postów: 36 557 Pomógł: 6315 Dołączył: 27.12.2004 ![]() |
http://pl.php.net/manual/en/function.glob.php
Cytat glob's regex does not offer any kind of quantification of a specified character or character class or alternation. For instance, if you have the following files:
a.php aa.php aaa.php ab.php abc.php b.php bc.php with pcre regex you can do ~^a+\.php$~ to return a.php aa.php aaa.php This is not possible with glob. If you are trying to do something like this, you can first narrow it down with glob, and then get exact matches with a full flavored regex engine. For example, if you wanted all of the php files in the previous list that only have one or more 'a' in it, you can do this: <?php $list = glob("a*.php"); foreach ($list as $l) { if (preg_match("~^a+\.php$~",$file)) $files[] = $l; } ?> -------------------- "Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista "Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer |
|
|
![]() ![]() |
![]() |
Aktualny czas: 19.08.2025 - 11:31 |