If you remove a slice, how do you compare it? Unlink

the name of the hypothetical card is

12-912-egjaeigaewogkewaogkeawokgaowegh.PNG

how do I skip other values when I want to give a value to unlink
?
hypothetical

unlink("12-912-egjaeigaewogkewaogkeawokgaowegh.PNG");

in this way, I can delete videos
, but suppose I only know the number 912
so how can I only get to xx-? -xxxxxxxx

unlink("-912-.");

delete
as long as it is completed, but like
which is not deleted in 9122, it has to be exactly the same!

Mar.23,2021

can be matched with regularities, which is very simple.

$str = '12-egjaeigaewogkewaogkeawokgaowegh.PNG';
$regexp = '/^(\d+)-(\w+)\.(jpg|png|jpeg)$/i';
preg_match($regexp, $str, $match);
print_r($match);

result:

Array
(
    [0] => 12-egjaeigaewogkewaogkeawokgaowegh.PNG
    [1] => 12
    [2] => egjaeigaewogkewaogkeawokgaowegh
    [3] => PNG
)
< hr >

Update 1 2018-07-05 16:18:21
A specific format can also be deleted by regular matching. You only need to modify the regularization, for example, the file name is
12-912-egjaeigaewogkewaogkeawokgaowegh.PNG
. Change the above regularization to

.
'/^(\d+)-912-(\w+)\.(jpg|png|jpeg)$/i'

is fine, and then it is used to determine whether $match is empty, and if it is empty, it does not match, it will not be deleted.


foreach(glob('*-912-*.*') as $file)
{
    unlink($file);
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e405d5-4489a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e405d5-4489a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?