jwu
V2EX  ›  问与答

麻烦能帮我看看这句正则在Python下面怎么无法匹配呢

  •  
  •   jwu · Aug 5, 2013 · 3566 views
    This topic created in 4682 days ago, the information mentioned may be changed or developed.
    regex = re.compile('''<a href="TeacherInfo.asp\?uid=(\d+)"><b>(.*)<\/b><\/a>''')
    regex = re.compile('''<a href="TeacherInfo.asp\?uid=(\d+)"><b>(.*)<\/b><\/a>.*[\s\S]*UId=\d+">(.*)<\/a>''')

    被备注的第一句能够正常匹配,但第二句就不行,但第二句在http://rubular.com/测试能够成功匹配,难道用了什么Python不支持的规则?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   836 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 20:54 · PVG 04:54 · LAX 13:54 · JFK 16:54
    ♥ Do have faith in what you're doing.