text 来自https://www.hackerrank.com/challenges/detect-html-links/problem

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 来自https://www.hackerrank.com/challenges/detect-html-links/problem相关的知识,希望对你有一定的参考价值。

import re

for _ in range(int(input())):
    line = input()
    #regex = re.compile('((?<=a\shref=").*(?=\"\>))(?:\"\>)(.*(?=\<\/a\>))')
    regex = re.compile('((?<=a\shref=")[\d\w\/\$\-\_\.\+\!\*\'\(\)\,\:]*)(?:.*\"\>)(.*(?=\<\/a\>))')
    result = re.search(regex,line)
    if (result):
        print(result.group(1)+','+result.group(2))
        
        
#Need to look at a "match everything until you find a '"' character' statement. Trying to account for all the \w\d\randomchar is silly

'<a href="(.*?)".*?>([^>]+)(?=</)'

New regex that is improved - not sure why this is failing and under what test cases

以上是关于text 来自https://www.hackerrank.com/challenges/detect-html-links/problem的主要内容,如果未能解决你的问题,请参考以下文章

text 来自ip的Wget

text 来自apto列表的回复

text 来自Adam的测试片段

text BM1682支持来自Caffe算子

text 来自cli的mysql查询

text 来自p1的isJson