PHP正则匹配不以指定字符串开头,以指定字符串结尾

 

 
 
 
 
 
PHP
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function match_domain($item, $key) {
    $pattern = '#^(?!edit|save)([a-zA-Z0-9]*).(gif|jpg|jpeg|png|bmp|swf){0,1}$#iU';
    preg_match_all($pattern, $item, $matches);
    echo $matches[0][0]."n";
}
 
$arr = array(
    'edittest.gifaaa',
    'savetest.gifbbb',
    'test.jpg',
    'edittest.gif',
    'esdaivte.png',
);
array_walk_recursive($arr, "match_domain");
posted @ 2015-08-14 14:56  拉风的牛  阅读(2919)  评论(0编辑  收藏  举报