Products
GG网络技术分享 2025-03-18 16:14 3
import re
a = 'from obps.a_2b2 obps.a_c3 obps.a_d4'
a1 = re.compile(r'obps.+\\w')
b = a1.findall(a,re.IGNORECASE)
print b
输出:['obps.a_2b2 obps.a_c3 obps.a_d4']
如何只输出obps字符后面的字符,a_2b2,a_c3,a_d4
可以这样写
r"(?<=obps\\.).*?(?=\\s|$)"
我们正在使用正则表达式处理文本,但是需要考虑处理Unicode字符。
默认情况下re模块已经对某些Unicode字符类型有了基本的认识。例如,d已经可以匹配任意Unicode数字字符了:
Demand feedback