<?php$str = '主要有以下几个文件:index.php, style.css, common.js';//将目标字符串$str中的文件名替换后增加em标签$replacement = '<em>$0</em>';$pattern = '/[a-z]+\.[a-z]+/i';echo preg_replace($pattern,$replacement,$str);
区分大小写