我想从文本中提取包含“~~帐户(ed或s)~~~~~ sale(s)”的所有部分。我在用python!在
例如
sentence = "Henry Schenin inc, accounted for approximately 11% of our net sale"
我的正则表达式
^{pr2}$然而,这
rx1.search(sentence)
只返回None
如果我用正则表达式
rx2 = re.compile('(.|\W){1,100}account(.|\W){1,100}for\W(.|\W){1,200}', re.I)
我得到了
<_sre.SRE_Match object; span=(0, 67), match='Henry Schenin inc, accounted for approximately 11>
有人能帮助我理解为什么这个正则表达式不能捕获百分号(%)后面的部分吗?在
{\I{I'want to start of the regular expressions.{I'want to start of the regular expressions.{I'want to start of the regular expressions。在
这对您当前的例子是有效的。 你需要一些方法来决定比赛从哪里开始,在这个例子中我已经习惯了
相关问题 更多 >
编程相关推荐