标签: 字符串
一则把不规范的字符串转为用横杠隔开的标准的SEO的URL的正则表达式
$str = '/The-URL-\//string-to-/the,-standard-SEO@html';
echo trim(preg_replace('/\-(?=\-)/','',preg_replace('/[^\w\-]/','-',$str)),'-');
//转化后 The-URL-string-to-the-standard-SEO-html
作者: Sjolzy
--EOF--