Improve regular expressions by using a backreference to match right quote of quote pair when matching attributes.

props kovshenin. see #24225.

git-svn-id: https://develop.svn.wordpress.org/trunk@24241 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2013-05-10 22:54:33 +00:00
parent a8fe299c1c
commit 5cd3b7c3ab
3 changed files with 10 additions and 10 deletions

View File

@@ -3206,7 +3206,7 @@ function links_add_target( $content, $target = '_blank', $tags = array('a') ) {
function _links_add_target( $m ) {
global $_links_add_target;
$tag = $m[1];
$link = preg_replace('|(target=[\'"](.*?)[\'"])|i', '', $m[2]);
$link = preg_replace('|(target=([\'"])(.*?)\2)|i', '', $m[2]);
return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">';
}