| When you use FCKedior or ueditor, the content pasted from word will generate many additional tags. This article will share a function to clear this extra html code, for more information, see.
Note: When FCKedior or ueditor is used, many additional labels will be generated when it is pasted from word. This section shares a code example to clear the html code generated by word. Example:
') {Mb_regex_encoding ('utf-8'); $ search = array ('/U', '/U','/"/U ', '/"/U','/-/u'); $ replace = array ('\'','\'','"','"', '-'); $ text = preg_replace ($ search, $ replace, $ text); $ text = html_entity_decode ($ text, ENT_QUOTES, 'utf-8 '); if (mb_stripos ($ text ,'/*')! = FALSE) {$ text = mb_eregi_replace ('#/\*.*? \ */# S ', '', $ text, 'M');} $ text = preg_replace (array ('/<([0-9] +) /'), array (' <$ 1'), $ text); $ text = strip_tags ($ text, $ allowed_tags ); $ text = preg_replace (array ('/^ \ s +/', '/\ s + $ /', '/\ s +/u'), array ('','', ''), $ text ); $ search = array ('# <(strong | B) [^>] *> (. *?)
# Isu', '# <(em | I) [^>] *> (.*?)
# Isu ','#
] *> (.*?)
# Isu '); $ replace = array ('$2','$2','$1'); $ Text = preg_replace ($ search, $ replace, $ text); $ num_matches = preg_match_all ("/\
|