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

"/(<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开头的内链

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

posted @ 2017-11-06 23:32  在下刘彦直  阅读(928)  评论(0编辑  收藏  举报