Jump to content

Recommended Posts

Posted

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" 😉 

 

  • Like 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...