Python regular expression again - match url

后端 未结 4 571
我在风中等你
我在风中等你 2020-12-03 22:37

I have such regexp:

 re.compile(r\"((https?):((//)|(\\\\\\\\))+[\\w\\d:#@%/;$()~_?\\+-=\\\\\\.&]*)\", re.MULTILINE|re.UNICODE)

But that

4条回答
  •  甜味超标
    2020-12-03 23:15

    I'll admit that I'm a little bit worried about an application that requires a regex like that to match URLs. That said, this seems to work for me:

    ((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)
    

提交回复
热议问题