re.search实例

    https://github.com/crifan/BlogsToWordpress/blob/master/libs/crifan/blogModules/BlogCsdn.py

    从内容中

    提取csdn帖子的标题

    1. foundTitle = re.search('<span class="link_title"><a href="[\w/]+?">\s*(<font color="red">\[置顶\]</font>)?\s*(?P<titleHtml>.+?)\s*</a>\s*</span>', html, re.S)
    2. titleHtml = foundTitle.group("titleHtml")
    3. logging.debug("titleHtml=%s", titleHtml)

    详见:

    https://github.com/crifan/BlogsToWordpress/blob/master/libs/crifan/blogModules/BlogCsdn.py

    1. </a>
    2. </span>

    提取出