Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,我有一个字符串 Banjo.ald:Mandolin.ald:Guitar.tst,我正在尝试找到将返回字符串 Guitar 的正则表达式。在上面的示例中,我在我感兴趣的文本之前有两个组(即 Banjo.ald:Mandolin.ald:),但实际上将有 1 到 N 个这些组,其中一个组被定义为 Banjo.ald:
如果您需要更清楚地了解我在寻找什么,请告诉我。
您可以使用贪婪的正则表达式,它将消耗所有内容,直到最后一个冒号。然后捕获后面的单词,直到.tst:
.tst
^.*:(.*).tst$