我有这个正则表达式:
(?<=[.!?])\s[A-Z]
我在这个文本上运行它:
The engineering plant, weapon and electronic systems, galley, and multitudinous other
equipment required to transform the new hull into an operating and habitable warship are
installed and tested. The prospective commanding officer, ship's officers, the petty
officers, and seamen who will form the crew report for training and intensive
familiarization with their new ship.
它产生:
he engineering plant, weapon and electronic systems, galley, and multitudinous other
equipment required to transform the new hull into an operating and habitable warship are
installed and tested.
he prospective commanding officer, ship's officers, the petty officers, and seamen who
will form the crew report for training and intensive familiarization with their new ship.
如您所见,它删除了句子的第一个字母。这不是因为它们是大写的(我测试过)。
如何修复它,使其不会删除句子的第一个字母?
(我正在使用 Python 3)
我使用了 re.split() 然后我打印了数组,用换行符分隔每个值