We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
def func(m): if not m.group(3).startswith("http"): rtn = m.group(1) + get_domain(url) + "/" + m.group(2) + m.group(3) #rtn = m.group(1) + domain + m.group(2) + m.group(3) return rtn else: return m.group(1) + m.group(2) + m.group(3) html = re.compile(pattern).sub(func, html)
我发现里面有问题,于是修改为
大家可以看下 https://regex101.com/ 的测试效果 m.group(2) 才是匹配那个网址哦 所以并不是错误的 m.group(3) 那个只是匹配到 ”
m.group(2)
m.group(3)
”
而我看不懂那个正侧替换,查参考资料官方是 re.sub(pattern, repl, string, count=0, flags=0)
re.sub(pattern, repl, string, count=0, flags=0)
repl是字符串 或者 函数
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我发现里面有问题,于是修改为
大家可以看下 https://regex101.com/ 的测试效果
m.group(2)
才是匹配那个网址哦所以并不是错误的
m.group(3)
那个只是匹配到”
而我看不懂那个正侧替换,查参考资料官方是
re.sub(pattern, repl, string, count=0, flags=0)
repl是字符串 或者 函数
The text was updated successfully, but these errors were encountered: