我有一个大的文本字符串,与init有几个块看起来非常相似
text = '\n\n(d)In the event of this happens a Fee
of \xc2\xa32,000 gross, on each such occasion.\n\n'
使用下面的代码,我可以找到所有的money实例:
^{pr2}$但是这只返回逗号In the event of this happens a Fee of \xc2\xa32,000 gross
而不是整个块,我希望返回提到Unicode for British-lb \xa3
的块
我建议使用以下正则表达式:
这将查找至少包含一个
\xa3
的非空行的所有多行块。在正如@wiktor stribiżew在一篇评论中指出的,这只会找到那些在井号符号后面有另一个字符的块;这似乎是您想要的,所以没有问题,但应该提到。在
试试这个:
相关问题 更多 >
编程相关推荐