How to remove
tags and more from a string?

前端 未结 7 1709
一生所求
一生所求 2020-12-04 00:08

I need to strip all
and all \'quotes\' (\") and all \'ands\' (&) and replace them with a space only ...

How c

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-04 01:07

    To manipulate HTML it is generally a good idea to use a DOM aware tool instead of plain text manipulation tools (think for example what will happen if you enounter variants like
    ,
    with more than one space, or even
    or
    , which altough illegal are sometimes used). See for example here: http://sourceforge.net/projects/simplehtmldom/

提交回复
热议问题