How to find if String contains html data?

后端 未结 7 2344
遇见更好的自我
遇见更好的自我 2020-12-15 18:13

How do I find if a string contains HTML data or not? The user provides input via web interface and it\'s quite possible he could have used either a simple text or used HTML

7条回答
  •  萌比男神i
    2020-12-15 19:05

    You have to get help only by the regular expression strings. They help you find out potential html tags. You can then compare the inner to contain any html keywords. If its found, put up an alert telling not to use HTML. Or simply delete it if you feel otherwise.

提交回复
热议问题