【发布时间】:2019-10-04 08:33:55
【问题描述】:
我正在尝试解析许多 txt 文件。以下text只是更大的txt文件的一部分。
<P STYLE="font: 10pt Times New Roman, Times, Serif; margin: 0; text-align: justify">Prior to this primary offering, there has
been no public market for our common stock. We anticipate that the public offering price of the shares will be between $5.00 and
$6.00. We have applied to list our common stock on the Nasdaq Capital Market (“Nasdaq”) under the symbol “HYRE.”
If our application is not approved or we otherwise determine that we will not be able to secure the listing of our common stock
on the Nasdaq, we will not complete this primary offering.</P>
我想要的输出:be between $5.00 and and $6.00。所以,我需要提取be between直到下面的.之间的任何东西(但不考虑小数点5.00!)。我尝试了以下(Python 3.7):
shareprice = re.findall(r"be between\s\$.+?\.", text, re.DOTALL)
但是这段代码给了我:be between $5.(停在小数点处)。我最初在字符串末尾添加了一个\s 以要求在. 之后有一个空格,这将保持5.00 小数点,但许多其他txt 文件在结尾@987654332 之后没有空格@的句子。
无论如何我可以在我的字符串中指定我想在\. 之后“跳过”数字数字吗?
非常感谢。我希望这很清楚。 最好的
【问题讨论】:
-
感谢@Wiktor!还是初学者
标签: regex python-3.x parsing findall