Remove URLs from text string

前端 未结 3 1277
滥情空心
滥情空心 2021-01-22 00:07

Is it possible to search for and remove URLs from a string in PHP. Talking about the actual text here not the HTML. Example to remove:

mywebsite.com
http://myweb         


        
3条回答
  •  情话喂你
    2021-01-22 00:29

    You could try something that looks for .TLD, where TLD is any existing top-level domain, but that may result in too many false positives.

    Would it be possible to implement a system where posts containing questionable content need moderation to be posted, but others are posted right away? I'm assuming it's a firm business requirement to disallow this type of content.

    Personally, I would tend to just prevent any hyperlinking, and leave it at that. But, it's not my app.

提交回复
热议问题