示例#1
0
function title_replacer_vg( $title, $replacement, $fulltext  ) {

	$wsc = 0;
	$regexp = get_regexp( $title, $replacement, $wsc );
	$regexp = "/^\\h*[vV][iI][dD][eE][oO]\\:" . $regexp . '(\\||\\h*$)/m';
	$new = preg_replace( $regexp, "Video:" . $replacement . "$".(1+$wsc), $fulltext );
	if( $new === null ) return $fulltext;
	return $new;
}
function title_replacer( $title, $replacement, $fulltext  ) {

	$wsc = 0;
	$regexp = get_regexp( $title, $replacement, $wsc );
	$regexp = '/(\\[\\[Video\\:)[ ]{0,}' . $regexp . '[ ]{0,}(( *)?#.*?)?'.'(\\]\\]|\\|[^]]+\\]\\])/';
	$new = preg_replace( $regexp, '$1' . $replacement . '$'.(4+$wsc), $fulltext );
	if( $new === null ) return $fulltext;
	return $new;
}
function title_replacer( $title, $replacement, $fulltext  ) {

	$wsc = 0;
	$regexp_org = get_regexp( $title, $replacement, $wsc );
	$regexp = '/(\\[\\[Video\\:)[ ]{0,}' . $regexp_org . '[ ]{0,}(( *)?#.*?)?'.'(\\]\\]|\\|[^]]+\\]\\])/';
	echo "Full regexp: $regexp\n";
	$new = preg_replace( $regexp, '$1' . $replacement . '$'.(4+$wsc), $fulltext );

	if( $new === null || $new == $fulltext ) {
		echo "No occurences found! Returning original\n";
		echo "Original is:\n";
		echo $fulltext;
		echo "\n";
		$res = preg_match($regexp_org, $fulltext);
		$res = var_export($res,1);
		echo "Pregmatch result:$res\n";
		return $fulltext;
	}
	return $new;
}