我希望使用正则表达式从文本下方输入特定的字符串。
str = 'Supervision68 - Outdoor Supervision In Compliance922 KAR 2:100 -
Section 10(15) Each child'
特定字符串:“ 68-符合户外监督规定”
我尝试获得以下结果:
re.findall('\d+(.*?)922', str)
结果:“-合规性户外监督”
答案 0 :(得分:0)
您几乎拥有它:
import re
str = 'Supervision68 - Outdoor Supervision In Compliance922 KAR 2:100 - Section 10(15) Each child'
print(re.findall('(\d.*?)922', str))
输出:
['68 - Outdoor Supervision In Compliance']