我使用PHP输出一些富文本.如何完全去除内联样式?
文本将直接从MS Word或OpenOffice粘贴到使用TinyMCE的文本中,TinyMCE是一种富文本编辑器,允许您向文本添加基本HTML格式.但是我想删除内联样式
标签(见下文),但保留
标记自己.
<p style="margin-bottom: 0cm;">A patrol of Zograth apes came round the corner, causing Rosette to pull Rufus into a small alcove, where she pressed her body against his. “Sorry.” She said, breathing warm air onto the shy man's neck. Rufus trembled.</p>
<p style="margin-bottom: 0cm;"> </p>
<p style="margin-bottom: 0cm;">Rosette checked the coast was clear and pulled Rufus out of their hidey hole. They watched as the Zograth walked down a corridor, almost out of sight and then collapsed …Run Code Online (Sandbox Code Playgroud) 我在用户输入的字段上使用正则表达式,以确保它们输入了1到20个字符.
这是代码:
$post_validations = array("title" => '/^[[:alnum:][:punct:][:space:]]{1,100}$/');
Run Code Online (Sandbox Code Playgroud)
但是每当用户输入外来字符或MS Word中的特殊引号字符时(我无法将其粘贴到此处,它将其转换为正常引用!)正则表达式不会返回true,并且它显示错误.
我想知道什么是最好的正则表达式使用?
谢谢