【发布时间】:2017-07-28 21:09:13
【问题描述】:
我需要在每种情况下罚款美元金额和金额之后的单词并且单词不可用,那么我应该只有美元金额。美元金额位于段落末尾的情况就是如此。 这是示例段落。
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).]
【问题讨论】:
-
到目前为止你尝试了什么?
-
你在这里做了很多事情,千方百计的地方和标点符号使你变得复杂。我认为正则表达式是不可靠的,因为你是从语言中挑选出来的。
-
@nutmeg64 我试图用 [\$]{1}[\d,]+\.?\d{0,2} (\w+) 查找金额
-
@sln 我尝试了类似 [\$]{1}[\d,]+\.?\d{0,2} (\w+) 但它在该段中遗漏了一些美元金额,所以我想尝试找到解决方案。实际上,我试图先找到美元金额,然后用空格分割所有段落,然后使用索引,但它不适用于最后一个(0.02 美元)。所以我想解决它...