UltraEdit正则表达式使用示例

1将“澳门,aomen,2;安康,ankang,345;安宁,anning,2742;鞍山,anshan,272;安庆,anqing,42;”转换为如下的结果:

array('name'=>'澳门','busname'=>'aomen','areaid'=>2),

array('name'=>'安康','busname'=>'ankang','areaid'=>345),

array('name'=>'安宁','busname'=>'anning','areaid'=>2742),

array('name'=>'鞍山','busname'=>'anshan','areaid'=>272),

array('name'=>'安庆','busname'=>'anqing','areaid'=>42),

array('name'=>'阿克苏','busname'=>'akesu','areaid'=>3226),

array('name'=>'安阳','busname'=>'anyang','areaid'=>180),

查找

(.*)\,(\w+)\,(.*)\;或者(.*)\,(.*)\,(.*)\;

替换

array('name'=>'\1','busname'=>'\2','areaid'=>\3),^r^n

array('name'=>'\1','busname'=>'\2','areaid'=>\3),

2替换PHP标签为{}:如为{$catstr}

查找

<\?\=(\S+)\?>

替换

{\1}

$tag_cache = false;
	$db_cache = ($expires == -2 || defined('TOHTML')) ? 'CACHE' : '';
	if($tag_expires && $db_cache != 'CACHE' && strpos($parameter, '&page=') === false) {
		$tag_cache = true;
		$TCF = DT_CACHE.'/tag/'.md5($parameter).'.htm';
		if(is_file($TCF) && ($DT_TIME - filemtime($TCF) < $tag_expires)) {
			echo substr(file_get($TCF), 17);
			return;
		}
	}
	$parameter = str_replace(array('&amp;', '%'), array('', '##'), $parameter);
	$parameter = strip_sql($parameter);
	parse_str($parameter, $par);
	if(!is_array($par)) return '';
	$par = dstripslashes($par);
	extract($par, EXTR_SKIP);
	isset($prefix) or $prefix = $db->pre;
	isset($moduleid) or $moduleid = 1;
	if(!isset($MODULE[$moduleid])) return '';
	isset($fields) or $fields = '*';
	isset($catid) or $catid = 0;
	isset($child) or $child = 1;
	isset($areaid) or $areaid = 0;
	isset($areachild) or $areachild = 1;
	(isset($dir) && check_name($dir)) or $dir = 'tag';
	(isset($template) && check_name($template)) or $template = 'list';
	isset($condition) or $condition = '1';
	isset($group) or $group = '';
	isset($page) or $page = 1;
	isset($offset) or $offset = 0;
	isset($pagesize) or $pagesize = 10;
	isset($order) or $order = '';
	isset($showpage) or $showpage = 0;
	isset($showcat) or $showcat = 0;
	isset($datetype) or $datetype = 0;

相关推荐