正则表达式python查找金额和单词,以防该金额位于段落末尾

正则表达式python查找金额和单词,以防该金额位于段落末尾,python,regex,split,words,Python,Regex,Split,Words,我需要罚款美元金额和文字后,在每一个案件的金额和文字是不可用的,那么我应该只有美元金额。在这种情况下,美元金额放在段落末尾。 这是一个示例段落 The cumulative effect resulted in a charge to incomeof $1,001.9 million (after reduction for income taxes of $6.4 million) in fiscal2001. Assuming the accounting change had be

我需要罚款美元金额和文字后,在每一个案件的金额和文字是不可用的,那么我应该只有美元金额。在这种情况下,美元金额放在段落末尾。 这是一个示例段落

The cumulative effect resulted in a charge to incomeof $1,001.9 million 
(after  reduction for income taxes of $6.4 million) in fiscal2001. Assuming 
the accounting change had been applied retroactively by theCompany to prior 
periods, pro forma net loss for fiscal 2000 and pro forma netincome for 1999 
would have been ($17.3) million and $12.6 million, respectively.Net loss per
common share would have been ($0.57) in 2000, and net income perdiluted share 
would have been $0.42 in 1999. Fiscal 2001 would have been $255.5 million and 
net loss percommon share would have been ($0.02).
我想找到

 [$1,001.9 million, $6.4 million), ($17.3) million, $12.6 million, ($0.57) in, 
 $0.42 in, $255.5 million, ($0.02).]

没有正则表达式,您可以轻松完成这项任务

['$' + ' '.join(line.split(" ")[:2]) for line in text.split("$")[1:]]

到目前为止,你尝试了什么?你在这里做了很多事情,千位和标点符号让事情变得复杂。我认为正则表达式是不可靠的,因为你把它从语言中挑选出来。@Nutmag64我试图用[\$]{1}[\d,]+\.?\d{0,2}(\w+)@sln来查找金额。我尝试了类似[\$]{1}[\d,]+\.\d{0,2}(\w+)的方法,但在该段中遗漏了一些金额,所以我想尝试找到解决方案。事实上,我试图先找到美元金额,然后用空格分割所有段落,然后使用索引,但最后一段(0.02美元)不起作用。所以我想解决它。。。