编程语言
首页 > 编程语言> > [Python]正则匹配字符串 | 蒲公英二维码图片url

[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正则表达式

标签:string,re,Python,url,fA,蒲公英,findall,9a
来源: https://www.cnblogs.com/kaerxifa/p/12005518.html