字母“i”本身的正则表达式是什么?

问题描述 投票:0回答:1

在以下英语句子中,字母

i
大写不正确。

with this notice know that i inscribe messages to inform.
a boy named "Will" said into a microphone that time is like a high-five.
i give lines to computers to find cities and sites. 
i am my eyes, and to view is to exist (cuanda tu ve, tu comprendes el significado del 'hay')
view that i will not be processing your application any further because i am eating an apple.

--------------------------------------------------------------------------------
wIth thIs notIce know that I InscrIbe messages to Inform.
a boy named "WIll" saId Into a mIcrophone that tIme Is lIke a hIgh-fIve.
I gIve lInes to computers to fInd cItIes and sItes. 
I am my eyes, and to vIew Is to exIst (cuanda tu ve, tu comprendes el sIgnIfIcado del 'hay')
vIew that I wIll not be processIng your applIcatIon any further because I am eatIng an apple.

当字母 i 不在另一个单词内部时,什么 Python 脚本会找到它?

我们可能想使用正则表达式库(名为 re)构造一个

正则表达式

当字母 i 出现在较大单词的内侧时,idea i 会忽略字母 i 当字母 i

i 孤立和/或用作 fi 第一人称单数代词时,我们希望ish 找到字母 i 什么Python脚本可以正确地大写italize字母“

I

”,并且不对文本执行任何其他操作? 您可以使用单词边界和 re.sub(): import re s = """with this notice know that i inscribe messages to inform. a boy named "Will" said into a microphone that time is like a high-five. i give lines to computers to find cities and sites. i am my eyes, and to view is to exist (cuanda tu ve, tu comprendes el significado del 'hay') view that i will not be processing your application any further because i am eating an apple. -------------------------------------------------------------------------------- wIth thIs notIce know that I InscrIbe messages to Inform. a boy named "WIll" saId Into a mIcrophone that tIme Is lIke a hIgh-fIve. I gIve lInes to computers to fInd cItIes and sItes. I am my eyes, and to vIew Is to exIst (cuanda tu ve, tu comprendes el sIgnIfIcado del 'hay') vIew that I wIll not be processIng your applIcatIon any further because I am eatIng an apple. """ print(re.sub(r'\bi\b', 'I', s))

regex string nlp regular-language
1个回答
0
投票

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.