[wp-hackers] Putting the P in WordPress

elflop at googlemail.com elflop at googlemail.com
Mon Jul 5 15:53:55 UTC 2010


(apologies Nathan, forgot Google doesn't auto send back to the list)

I haven't got a login for Trac, but the issue being discussed was covered  
in an acronym plugin some time ago.
http://wordpress.org/extend/plugins/acronyms/
the portion of code he ended up using was:
function acronym_replace ( $text )
{
$acronyms = get_option( 'acronym_acronyms' );
$text = " $text ";
foreach ( $acronyms as $acronym => $fulltext )
$text = preg_replace( "|(?!<[^<>]*?)(?<![?.&])\b$acronym\b(?!:)(?![^<>]*?>)| 
msU", "<acronym title=\"$fulltext\">$acronym</acronym>" , $text );
$text = trim($text);
return $text;
}


so is that preg_replace of any use here?

Rich


More information about the wp-hackers mailing list