简体   繁体   English

在emacs regexp中使用“M-x发生”的“或”运算符

[英]“Or” operator in emacs regexp with `M-x occur`

I've wanted to get an overview of my Python program, so I ran: 我想要概述一下我的Python程序,所以我跑了:

Mx occur

and for the regexp I've supplied 而且我提供的正则表达式

(def)|(class)

which failed to match anything. 没能匹配任何东西。

I've also looked at this post, and tried 我也看过这篇文章,试过了

(def)\\\\|(class)

but this failed to match anything either... 但这无法匹配任何东西......

How do I get Mx occur to match class or def ? 如何让匹配classdef Mx occur

你必须使用单反斜杠(没有括号,或者你也应该转义括号):

def\|class

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM