可否帮我写两个正则。一个是匹配网页中的"关键字"/<meta([\s]+)content=\"(.*?)\"([\s]+)name=\"keywords\"([\s]?)(\/)?>/is"一个是匹配网页中的"描述"/<meta([\s]+)content=\"(.*?)\"([\s]+)name=\"description\"([\s]?)(\/)?>/is"这两个有的可以正确匹配,有的就匹配不了。。很郁闷啊。特别是“描述”的匹配
如 http://www.itravelqq.com/我不太懂这个正则,所以写得不标准,老是出问题,请高手指教!
如 http://www.itravelqq.com/我不太懂这个正则,所以写得不标准,老是出问题,请高手指教!
/<meta.*keywords.*>/i
描述:
/<meta.*description.*>/i
php 提供了很好的函数 get_meta_tags()
<meta[\\p{Print}&&[^>]]+name=([\"']?)description\\1[\\p{Print}&&[^>/]]+content=([\"']?)([\\p{Print}&&[^>/]]+)\\2
"<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />"
像这样的取不出来。我想得到UFT-8