/** * @desc 判断是否为URL地址 * @param {String} str * @return {Boolean} */ const isUrl = (str) => { return /[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/i.test(str) } module.exports = isUrl