ruby 正则匹配非站内链接
程序员文章站
2022-07-16 13:38:24
...
def has_href_not_XXX?(content)
content = content.dup
loop do
content.sub!(/href=(['"])([^'"]+)\1/, "")
if $2.blank?
return false
else
if (!$2[".XXX.com"])
return true
end
end
end
end
下一篇: ruby & rails 安装