Detect URLs in text with JavaScript

后端 未结 13 2275
孤城傲影
孤城傲影 2020-11-22 06:23

Does anyone have suggestions for detecting URLs in a set of strings?

arrayOfStrings.forEach(function(string){
  // detect URLs in strings and do something sw         


        
13条回答
  •  南旧
    南旧 (楼主)
    2020-11-22 07:10

    This library on NPM looks like it is pretty comprehensive https://www.npmjs.com/package/linkifyjs

    Linkify is a small yet comprehensive JavaScript plugin for finding URLs in plain-text and converting them to HTML links. It works with all valid URLs and email addresses.

提交回复
热议问题