[Python]正则匹配字符串 | 蒲公英二维码图片url

代码示例:

import re


def Find(string):
    # findall() 查找匹配正则表达式的字符串  
    url = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',string)


    return url
string = 'appQRCodeURL: https://www.pgyer.com/app/qrcxxxxstory/d5eab71a31cf12ac42377xxxxxxxxx886c7e571fd7ac63ae6e2475d37e2'

print("Urls: ", Find(string))

执行结果:

 

 

参考文档:python的url正则表达式

posted @ 2019-12-08 13:38  wangju003  阅读(379)  评论(0编辑  收藏  举报