正则表达式匹配外链和内链

"/(<link[^>]+href="([^"]+)"[^>]*>)|(<script[^>]+src="([^"]+)"[^>]*>)|(<img[^>]+src="([^"]+)"[^>]*>)|(<a[^>]+href="([^"]+)"[^>]*>)|(<link[^>]+href='([^']+)'[^>]*>)|(<img[^>]+src='([^']+)'[^>]*>)|(<script[^>]+src='([^']+)'[^>]*>)|(<a[^>]+href='([^']+)'[^>]*>)/i"

href=["'](http.*?)["'] //用于匹配带HHTP的链接

href=["']([^https].*?)["'] |href=["']([ttps].*?)["']  //用于匹配不是以h开头的内链

如果有完整匹配内链的方式,请评论留言分享一下

原文地址:https://www.cnblogs.com/paddygege/p/7795859.html