好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

正则草稿

正则草稿

r"""<a[\s\S]*?href=("|')(?P<link>http://www.cnblogs.com/lexus/archive/\d{4}/\d{1,2}/\d{1,2}/\d{1,}\.html)\1 """

match = re.search(r"""<a[\s\S]*?href=("|')(?P<link>http://www.cnblogs.com/lexus/archive/\d{4}/\d{1,2}/\d{1,2}/\d{1,}\.html)\1[\s\S]*?>(?P<img>[\s\S]*?)<[\s\S]*?/[\s\S]*?a[\s\S]*?>""", subject)

if match:

# match start: match.start()

# match end (exclusive): match.end()

# matched text: match.group()

else:

# Match attempt failed

查看更多关于正则草稿的详细内容...

  阅读:43次

上一篇: massive_record exmple

下一篇:github学习