Ruby中如何判断字符串是否包含HTML元素?
- 内容介绍
- 文章标签
- 相关推荐
本文共计175个文字,预计阅读时间需要1分钟。
如何用Ruby检查字符串是否为HTML?
如果字符串包含HTML标记,则返回true,否则返回false。
If string contains tag then returns true, otherwise returns false。
此测试(string contains )不足以确定字符串是否为HTML。
我们如何使用 Ruby检查字符串是否为HTML?如果string包含html标记,则返回true,否则返回false
If string contains html tag then returns true otherwise false
此测试(“string contains< html>”)不足以确定字符串是否为HTML.
How can we check the string is HTML or not using Ruby?
优秀的Nokogiri gem提供HTML验证.
$gem install nokogiri require 'nokogiri' Nokogiri::HTML.parse("<foo>bar</foo>").validate # => [#<Nokogiri::XML::SyntaxError...>, ...]
本文共计175个文字,预计阅读时间需要1分钟。
如何用Ruby检查字符串是否为HTML?
如果字符串包含HTML标记,则返回true,否则返回false。
If string contains tag then returns true, otherwise returns false。
此测试(string contains )不足以确定字符串是否为HTML。
我们如何使用 Ruby检查字符串是否为HTML?如果string包含html标记,则返回true,否则返回false
If string contains html tag then returns true otherwise false
此测试(“string contains< html>”)不足以确定字符串是否为HTML.
How can we check the string is HTML or not using Ruby?
优秀的Nokogiri gem提供HTML验证.
$gem install nokogiri require 'nokogiri' Nokogiri::HTML.parse("<foo>bar</foo>").validate # => [#<Nokogiri::XML::SyntaxError...>, ...]

