thomas Posted June 5 Posted June 5 Hi, I want to regex-replace terms with are stored in a simple text filed within a TinyMCE textarea value. Now I found that TinyMCE seems to encode entities differently than $sanitizer->entities() does. German "Umlaute" öäüÜÖÄ are encoded, but $sanitizer encodes quotes while TinyMCE doesn't. Is there a way to match the two encodings for reliable regex-replaces? Thanks $text = preg_replace("/(^|\s|>)".wire("sanitizer")->entities($member->title)."(\s|,|\.)/",'${1}<a href="'.$member->url.'">'.$member->title.'</a>${2}',$text); ^^ This successfully replaces names with umlauts like "Günter" but fails on people with nicknames like Jake "The Snake" 😉 1
BillH Posted June 6 Posted June 6 Take a look at the flags for $sanitizer->entities(), which is essentially a wrapper for PHP's htmlentities(). You could also consider PHP's htmlspecialchars().
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now