I need the pattern for preg_replace to wrap all sequences of latin characters and digits within the whole HTML page with the tag <span class="text=arial"></span>
.
For example, the following HTML part
<a href="http://domain.com/path" target="_blank">GSPd 役に立つツール: スキル意欲マトリクス</a>
should be replaced with:
<a href="http://domain.com/path" target="_blank"><span class="text=arial">GSPd</span> 役に立つツール: スキル意欲マトリクス</a>
Obviously, only the inner node text should be processed in such way so replacement won't break HTML tags.
What I've tried:
$p = '#(?<=\>)([a-zA-Z0-9]+)(?=\<)#ium';
$html = preg_replace(
$p,
'><span class="text-arial">$0</span><',
$html
);
This pattern should be extended to include situations when the content consists of mixed characters, e.g. GSPd 役に立つツール: スキル意欲マトリクス 100