【问题标题】:Notepad++ - match only lines that only contain CAPITAL LETTERS(or whitespace)Notepad++ - 仅匹配仅包含大写字母(或空格)的行
【发布时间】:2015-06-03 21:32:51
【问题描述】:

因此,[A-Z] 之类的内容将匹配大写字母。如何匹配完全大写的行(或具有空格/类似空格的实体)?因此,在下面的示例中,我想根除第一行并保留其余所有...

EVIL WIZARD
Ye insolent peasant swine!
By the demonic creatures
Resident in my ancient beard
Ye shall know true misery
Before this day is done!

[EVIL WIZARD laughs maniacally as hordes of rodents eat everything in sight]

鉴于我的剧本写作技巧,删除所有文本的正则表达式可能更合适,但是嘿...

【问题讨论】:

    标签: regex notepad++


    【解决方案1】:

    您可以使用^([A-Z\s]+)$ 正则表达式来选择只包含大写单词(但没有标点符号)的行。

    如果要选择大写单词的行,可以使用\b[A-Z]+\b regex。

    不要忘记选择匹配大小写选项!

    【讨论】:

    • 完美,谢谢!任何地方都有这类东西的不错的备忘单吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-25
    • 2011-02-24
    相关资源
    最近更新 更多